Peeking isn't a system-level I/O operation. It's associated with the
FILE* buffer placed on top of the file descriptor. The only way to tell if the FIFO is closed is to have a
read operation return 0 bytes read, which the libc interface handles internally (you don't deal with it directly when using
FILE*.)
ta0kira
PS Place this right after
fdopen on the reading end and see what happens:
Code:
setvbuf(/*FILE**/ your_file, NULL, _IONBF, 0);
fcntl( /*int*/ your_fd, F_SETFL, fcntl(/*int*/ your_fd, F_GETFL) | O_NONBLOCK ); //(needs <fcntl.h>)
You'll need to allow for empty reads that aren't necessarily indicative of EOF.