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

Operating Systems / DragonFlyBSD - Matthew Dillon [apollo.backplane.com] - 13 May 2021 17:37 UTC

- 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).

6df899ee53 kernel - Implement POLLHUP for pipes and filesystem fifos (3)
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(-)

Upstream: gitweb.dragonflybsd.org


  • Share