kern/53447: poll(2) semantics differ from susV3/POSIX

Bruce Evans bde at FreeBSD.org
Mon Apr 25 10:17:11 PDT 2005


Synopsis: poll(2) semantics differ from susV3/POSIX

Responsible-Changed-From-To: freebsd-standards->bde
Responsible-Changed-By: bde
Responsible-Changed-When: Mon Apr 25 17:04:09 GMT 2005
Responsible-Changed-Why: 
FreeBSD has changes that are supposed to fix problems in this area,
but the changes seem to just make things worse -- there are now
at least 2 more PRs about the new misbehaviour.

The correct fix seems to be to simply implement POLLHUP, and not ignore
EOF on FIFOs like FreeBSD does now.  On EOF, applications polling for
POLLIN (including via select() on a read descriptor) should get POLLIN
returned (or the read descriptor bit set for select()) like they used
to.  For poll(), POLLHUP is set too, and applications should check
this if they don't want to read EOF.  For select(), it is not easy
to avoid endlessy reading EOF in some cases, but POSIX is very clear
(much clearer than for poll()) that select() on a read descriptor must
return immediately on EOF.


http://www.freebsd.org/cgi/query-pr.cgi?pr=53447


More information about the freebsd-standards mailing list