DragonFly commits List (threaded) for 2010-08
git: kernel - make POLLHUP conform better to OpenGroup
Author: Matthew Dillon <firstname.lastname@example.org>
Date: Fri Aug 13 15:06:12 2010 -0700
kernel - make POLLHUP conform better to OpenGroup
* The poll() backend now only evaluates EV_EOF for EVFILT_WRITE, and
generates a POLLHUP which is properly mutually exclusive with
POLLWRNORM and POLLOUT.
We do this even for a half-closed (write-side-closed) socket.
* We no longer set POLLHUP for POLLRD* or POLLIN, instead relying on
the userland doing the read() and checking the 0 result (which
userland has always done historically).
EV_EOF for EVFILT_READ cannot be used to set POLLHUP for POLLRD* or
POLLIN because it could indicate a half-closed connection
(read-side-closed) where writing is still allowed, which is a more
common situation on sockets.
We would have to add another EV_ flag to set POLLHUP for POLLRD* or
POLLIN to detect the fully disconnected state. The OpenGroup standard
does allow POLLHUP to be mixed with POLLRD* or POLLIN but for now we
just don't set it at all in that case.
Only a POLLOUT/POLLWRNORM flag request can cause POLLHUP to be set
Summary of changes:
sys/kern/sys_generic.c | 37 ++++++++++++++++++++++++++++++-------
1 files changed, 30 insertions(+), 7 deletions(-)
DragonFly BSD source repository