Try to open /dev/null, and then to poll the file descriptor. Neither in the man page nor in the standard I see anything preventing you to poll on /dev/null, yet, it does not work on Mac OS X. You get a POLLNVAL.
Run the following: https://gist.github.com/elazarl/5805848 #include <stdio.h> #include <poll.h> #include <fcntl.h> int main() { int fd = open("/dev/null", O_WRONLY); struct pollfd pollfds = { fd, POLLOUT, 0 }; if (fd < 0) { perror("open"); return 1; } if (poll(&pollfds, 1, -1) < 0) { perror("poll"); return 2; } if (pollfds.revents == POLLNVAL) { puts("huh? why poll({/dev/null, POLLOUT, 0}, 1) returns POLLNVAL?"); } if (pollfds.revents == POLLOUT) { puts("working as expected"); } return 0; } Is there anything I'm missing? Or is it a real vaguely implemented corner of the standard. If it is, I'll be glad to see a list of supported/unsupported platforms, as well as list of other corner cases (for instance, POLLHUP may or may be received on EOF).
_______________________________________________ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il