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

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

- pipes need the same shutdown-vs-closed treatment. Only trigger POLLHUP when the other end is closed. Do not trigger POLLHUP when the other end issues a shutdown(..SHUT_WR).

- NOTE: Linux does not support shutdown() on pipes because linux pipes are half-duplex. BSD pipes are full-duplex and shutdown() makes more sense. That said, make shutdown()'s POLLHUP behavior uniform across the board... meaningthat shutdown() does NOT trigger POLLHUP, only a complete close().

This is important because I suspect linux programmers might use POLLHUP to try to detect unexpected terminations, whereas a shutdown() is par for the course when communications are being shut-down in an expected manner.

26a9aa6b93 kernel - Implement POLLHUP for pipes and filesystem fifos (4)
sys/kern/sys_pipe.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)

Upstream: gitweb.dragonflybsd.org


  • Share