According to http://www.opengroup.org/onlinepubs/000095399/functions/open.html the open() function shall fail and sets errno to ENXIO if O_WRONLY | O_NONBLOCK is set, the named file is a FIFO, and no process has the file open for reading.
This is not the case on Cygwin, as demonstrated by the attached test case. I get "This should not happen.", while the same program outputs "No process is reading from the other end." on both Linux and Solaris. -- Enrico
#include <stdio.h> #include <errno.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #define FIFONAME "/tmp/xyz.xyz" int main(void) { int fd; if (mkfifo(FIFONAME, 0600) < 0) { perror("Error"); exit(1); } fd = open(FIFONAME, O_WRONLY | O_NONBLOCK); if (fd >= 0) { puts("This should not happen."); close(fd); } else if (errno == ENXIO) { puts("No process is reading from the other end."); } remove(FIFONAME); return 0; }
-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/