I’m using Qnx 4 and Watcom C 10.6, to write to a FIFO file.
I have made a FIFO file with mkfifo fifoprod and i using C to write to this
FIFO.
write.c
fp_fifo = open(“fifoprod”,O_WRONLY | O_NONBLOCK);
if(fp_fifo != -1)
{
for(;
{
errno = 0;
result = write(fp_fifo,produit,sizeof(struct s_produit)); //
sizeof(struct s_produit) = 121
errvalue = errno;
if(result == -1)
printf("\nErrvalue=%d",errvalue);
// I got errvalue=11 if i checked in the errno.h 11 is equal to
EAGAIN
// and EAGAIN in the write documentation saided this;
// The O_NONBLOCK flag is set for the file descriptor, and the
process would be delayed in the write operation
delay(1000); // 1000ms When i write to each 1000ms to the FIFO it`s
working fine
// If i write to each 500ms i got the write
error EAGAIN after 90 write each 60% of the time
}
}
My process cannot wait for the FIFO to write in the file.
What EAGAIN really means.
Can someone help me or give me some hint.
Thanks Roger.