a file descriptor is also ready on end-of-file |
On success, the number of bytes read is returned (zero indicates end of file) |
EBADF An invalid file descriptor was given in one of the sets. (Perhaps a file descriptor that was already closed, or one on which an error has occurred.) Me adding: This would be on the read side (not write side), in your program read is still open. EINTR A signal was caught; see signal(7). EINVAL nfds is negative or the value contained within timeout is invalid. ENOMEM unable to allocate memory for internal tables. |
|
|
|
|
//-------------------------------------------------------- // Execute them both in two different terminals //-------------------------------------------------------- $ ./fifoWrite Process 2233 opening FIFO O_WRONLY Process 2233 result 3 Writing Writing Writing ^C $ //---------------------------------------------------- // In another terminal //---------------------------------------------------- $ ./fifoRead Process 2235 result 3 Time out Time out Reading Time out Reading Time out Reading Time out Reading EOF $ |
EBADF An invalid file descriptor was given in one of the sets. (Perhaps a file descriptor that was already closed, or one on which an error has occurred.) Me adding: This would be on the read side (not write side), in your program read is still open. |