Search:

Type: Posts; User: np2k

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    8
    Views
    3,980

    i've found the problem... the right line of...

    i've found the problem...
    the right line of semop functions is:


    semop(sem_id,operations,3)


    because the last argument nsops is the number of sembuf structures in the array!
    i.e.
  2. Replies
    8
    Views
    3,980

    MK27...you were in right... it's my fault. the...

    MK27...you were in right...
    it's my fault. the problem is another!!!!



    #include <stdio.h>
    #include <sys/stat.h>
    #include <sys/types.h>
    #include <sys/ipc.h>
    #include <sys/sem.h>
  3. Replies
    8
    Views
    3,980

    no...i'm not in luck... when i program the...

    no...i'm not in luck...
    when i program the software with semaphore i don't have the behavior described in the second man pages...
    the behavior of the semaphore. more precisely, of
    semop function...
  4. Replies
    8
    Views
    3,980

    if i write: man semop i have this man: ...

    if i write:


    man semop

    i have this man:



    SEMOP(2) Linux Programmer’s Manual SEMOP(2)
  5. Replies
    8
    Views
    3,980

    processes semaphore

    Hi all.
    I want compile my program that uses semaphore for processes with the posix standard...but if I compile my program with:


    gcc -o myprogram myprogram.c

    I don't have the behavior of the...
  6. Replies
    4
    Views
    11,483

    get length of a stream

    Hi all.
    I want get the length of a stdin. i.e


    cat test.txt | myprogram

    the program myprogram reads the test.txt and returns the length of the file test.txt
  7. Replies
    3
    Views
    2,632

    FIFO "connections"

    I've this code and a client that send data on the FIFO.
    I start the client and the daemon below works perfectly. But when the client stop beacause of while cycle we go to "read function" and now...
  8. Replies
    9
    Views
    2,831

    yes, it's an elegant solution

    yes, it's an elegant solution
  9. Replies
    9
    Views
    2,831

    for example, if you want the output of ls command...

    for example, if you want the output of ls command you can use the following code.
    but...first of all: this is a dirty solution: if your program must does other things, you will fork the process and...
  10. Replies
    9
    Views
    2,831

    as soon as i have a bit of time i write you the...

    as soon as i have a bit of time i write you the solution for get the output of system
  11. Replies
    9
    Views
    2,831

    I've understand only the first part of your...

    I've understand only the first part of your message:

    you can use a pipe&dup2 function to redirect the output of system() to the read-end of the pipe...If this does not say anything, let me know...
  12. Replies
    16
    Views
    16,506

    yes but I need the sem value for debugging my...

    yes but I need the sem value for debugging my software

    @tabstop: I know what an int* is...the strange -for me- is that I'm so lucky to get no error using arg.array without any allocation
  13. Replies
    16
    Views
    16,506

    seg fault :S it seems very strange...

    seg fault

    :S it seems very strange...
  14. Replies
    16
    Views
    16,506

    ok, but...there is the question 2...without...

    ok, but...there is the question 2...without malloc the things work....
  15. Replies
    16
    Views
    16,506

    1. I don't understand....why should be my work...

    1. I don't understand....why should be my work allocating the space for argument.array? It should be responsibility of the semctl function allocate this space...
    2. and why the code I post works...
  16. Replies
    16
    Views
    16,506

    first of all i must set arg.array if i use...

    first of all i must set arg.array if i use SETALL...with GETALL cmd i want the information into senum argument...

    then -reapet- I can retrieve the current value of the sem with these lines:

    ...
  17. Replies
    16
    Views
    16,506

    yes...and then? I use semun array...have a look...

    yes...and then?
    I use semun array...have a look to my code
  18. Replies
    16
    Views
    16,506

    but wait wait.... unsigned short int...

    but wait wait....



    unsigned short int get_semvalue(int sem_id) {
    union semun argument;
    semctl(sem_id,0,GETALL,argument);
    return argument.array[0];
    }
  19. Replies
    16
    Views
    16,506

    i response to myself..... i don't init the...

    i response to myself.....
    i don't init the sem_id value, just call the semget loosing the return value. so:


    sem_id=semget(IPC_PRIVATE,1,IPC_CREAT|IPC_EXCL|S_IRUSR|S_IWUSR);


    damn me!
  20. Replies
    16
    Views
    16,506

    how to read current semaphore value

    Hi all. I'm using semaphore for processes.
    Here a simple code:


    ...
    //include declarations
    ...

    union semun {
    int val;
  21. Replies
    13
    Views
    2,847

    thanks... sorry but I have not explained...

    thanks...


    sorry but I have not explained well, i'm italian and my english is not good. all of your speech was clear, from long time...I said something else, but now it's no important because I...
  22. Replies
    13
    Views
    2,847

    damn it! I had missed a "silly" detail... but,...

    damn it! I had missed a "silly" detail...

    but, wait...what a dirty thing! in this way, in thread_function routine I get the value of the args pointer's address which coincides with the value of i...
  23. Replies
    13
    Views
    2,847

    yes, salem. thanks for your links...but i've...

    yes, salem. thanks for your links...but i've studied the threads and the program that i've post has a strange behavior: i don't have understand why.
  24. Replies
    13
    Views
    2,847

    ok, let me understand please

    ok, let me understand please
  25. Replies
    13
    Views
    2,847

    i don't understand...and, anyway, what could be a...

    i don't understand...and, anyway, what could be a solution to this problem?
Results 1 to 25 of 26
Page 1 of 2 1 2