git: kernel - make POLLHUP conform better to OpenGroup

Matthew Dillon dillon at
Fri Aug 13 15:14:17 PDT 2010

commit 9a5d20db2b31ebaf094a3cb60c7342b1026f2947
Author: Matthew Dillon <dillon at>
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
      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
      for now.

Summary of changes:
 sys/kern/sys_generic.c |   37 ++++++++++++++++++++++++++++++-------
 1 files changed, 30 insertions(+), 7 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list