kernel - Implement POLLHUP for pipes and filesystem fifos (3)
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 13 May 2021 17:37:03 +0000 (10:37 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 13 May 2021 17:37:03 +0000 (10:37 -0700)
commit6df899ee53ae3a3e10f330d9bae5c8a486352714
treeb44c5ca5f1d1347a5e6595192e7c0dd449e9cc78
parente366ffe0eedef1bf5302b694d2e73c8a7f89b374
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).
sys/kern/sys_generic.c
sys/kern/sys_pipe.c
sys/kern/uipc_socket.c
sys/sys/event.h
sys/vfs/fifofs/fifo_vnops.c