HomeFreeBSD

pipe: fix POLLHUP handling if no events were specified

Description

pipe: fix POLLHUP handling if no events were specified

Linux allows polling without any events specified and it happens to be the case
in FreeBSD as well. POLLHUP has to be delivered regardless of the event mask
and this works fine if the condition is already present. However, if it is
missing, selrecord is only called if the eventmask has relevant bits set. This
in particular leads to a conditon where pipe_poll can return 0 events and
neglect to selrecord, while kern_poll takes it as an indication it has to go to
sleep, but then there is nobody to wake it up.

While the problem seems systemic to *_poll handlers the least we can do is fix
it up for pipes.

Reported by: Jeremie Galarneau <jeremie.galarneau at efficios.com>
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D27094

Details

Provenance
mjgAuthored on
Reviewer
kib
Differential Revision
D27094: pipe: fix POLLHUP handling if no events were specified
Parents
rS367351: Make the tests work without COMPAT_FREEBSD12 in kernel.
Branches
Unknown
Tags
Unknown