git: kernel - Implement POLLHUP for pipes and filesystem fifos (3)

Matthew Dillon dillon at crater.dragonflybsd.org
Thu May 13 10:41:35 PDT 2021


commit 6df899ee53ae3a3e10f330d9bae5c8a486352714
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Thu May 13 10:37:03 2021 -0700

    kernel - Implement POLLHUP for pipes and filesystem fifos (3)
    
    * Add an internal NOTE_HUPONLY flag to allow the poll() system call
      to tell the kevent system that EVFILT_READ should only trigger on
      a HUP and not trigger on read-data-present.
    
    * Linux does not trigger POLLHUP on a half-closed socket, make
      DFly have the same behavior.  POLLHUP is only triggered on a fully-closed
      socket.
    
    * Fix bug where data-present on the pipe, socket, or fifo would trigger an
      EVFILT_READ event when only a HUP is being requested.  This caused our
      poll() implementation to complain about spurious events (which then
      results in incorrect operation).

Summary of changes:
 sys/kern/sys_generic.c      | 14 ++++++++++----
 sys/kern/sys_pipe.c         |  2 +-
 sys/kern/uipc_socket.c      | 37 ++++++++++++++++++++++++++++++-------
 sys/sys/event.h             |  9 +++++++--
 sys/vfs/fifofs/fifo_vnops.c |  4 +++-
 5 files changed, 51 insertions(+), 15 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/6df899ee53ae3a3e10f330d9bae5c8a486352714


-- 
DragonFly BSD source repository



More information about the Commits mailing list