Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Unhappy Help me with programming problem


    I'm studying linux internals programming. can anyone tell me what is wrong in the following program? it hangs at the open statement.... I'm getting the "1" value which mkfifo returns...

    int main()
    int a,b=4,fid;
    printf("\n\n Hello World \n\n");
    printf("\n mkfifo returnes : %d\n",a);
    printf("given number is : %d",b);
    return 0;

  2. #2
    Try adding the flag O_NONBLOCK | O_WRONLY to the open call. Then it wont block on the open.

    man 2 open
    When possible, the file is opened in non-blocking mode. Neither the open() nor any subsequent operations on the file descriptor which is returned will cause the calling process to wait. For the handling of FIFOs (named pipes), see also fifo(7). For a discussion of the effect of O_NONBLOCK in conjunction with mandatory file locks and with file leases, see fcntl(2).

    Out of a man fifo:
    A process can open a FIFO in non-blocking mode. In this case, opening for read only will succeed even if no-one has opened on the write side yet; opening for write only will fail with ENXIO (no such device or address) unless the other end has already been opened.

  3. #3


    thanks... it's working now...

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts