Page MenuHomeFreeBSD

kern: unix: raise POLLIN when the remote end has shutdown writes
ClosedPublic

Authored by kevans on May 30 2025, 1:59 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Sep 25, 6:04 AM
Unknown Object (File)
Wed, Sep 17, 7:26 PM
Unknown Object (File)
Sep 9 2025, 7:29 PM
Unknown Object (File)
Sep 9 2025, 5:26 PM
Unknown Object (File)
Aug 29 2025, 4:43 PM
Unknown Object (File)
Aug 29 2025, 11:57 AM
Unknown Object (File)
Aug 28 2025, 8:05 AM
Unknown Object (File)
Aug 28 2025, 7:41 AM
Subscribers

Details

Summary

Historically, select(2) and poll(2) will return POLLIN if the next
read(2) would return EOF to signal that the application should try.

Fix the new stream/seqpacket poll implementation to do the same to avoid
breaking applications that expect it, and select(2) which won't poll
for POLLRDHUP. select(2) arguably should poll for POLLRDHUP on the
read set as well, but poll(2) should also surface it with only
events=POLLIN.

Fixes: d15792780760e ("unix: new implementation of unix/stream [...]")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.May 30 2025, 2:42 AM
sys/kern/uipc_usrreq.c
1695 ↗(On Diff #156284)

Looking at uipc_socket.c's sopoll_generic, I wonder if this should instead be this to be technically correct (not that I can find anything actually using POLLIGNEOF except for the implicit use in pipe stuff?)

sys/kern/uipc_usrreq.c
1695 ↗(On Diff #156284)

Gleb tried to get rid of POLLINIGNEOF. The bit is with us forever due to ABI reqs.

So most likely you are right.