Editing POLLHUP polling
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 27: | Line 27: | ||
The only talk of this issue I've found online is the 2001 email "[https://groups.google.com/g/comp.unix.programmer/c/bNNadBIEpTo/m/G5gs1mqNhbIJ poll() and events==0]" which has no clear answers. | The only talk of this issue I've found online is the 2001 email "[https://groups.google.com/g/comp.unix.programmer/c/bNNadBIEpTo/m/G5gs1mqNhbIJ poll() and events==0]" which has no clear answers. | ||
== | == General POLLHUP lore == | ||
Richard Kettlewell's [https://www.greenend.org.uk/rjk/tech/poll.html poll() and EOF] page has some interesting | |||
- events = POLLIN | |||
- doesn't write to the socket first | |||
- may indicate with POLLIN | |||
- may indicate with POLLHUP | |||
- may indicate with BOTH | |||
- On socket disconnection, POLLIN set in poll()->revents and recv() returning 0 is the only portable and reliable method. | |||
https://www.illumos.org/issues/4627 not generating POLLHUP dangers | |||
https://github.com/illumos/illumos-gate/commit/68846fd00135fb0b10944e7806025cbefcfd6546 | |||
- stuff to read still in socket | |||
- may indicate with POLLOUT if the socket has failed to connect in the first place | |||
<nowiki>https://lkml.iu.edu/hypermail/linux/kernel/0605.1/1420.html</nowiki> | |||
https://jira.mongodb.org/browse/CDRIVER-2996 POLLOUT<nowiki/>https://lists.freebsd.org/pipermail/freebsd-net/2011-September/029712.html | |||
freebsd different ideas | |||
POLLIN but no data, only POLLHUP <nowiki>https://sourceware.org/bugzilla/show_bug.cgi?id=13660</nowiki> | |||
<nowiki>https://developer.illumos.narkive.com/dUe1v0Ya/poll-not-returning-pollhup-for-tcp-sockets-closed-by-the-other-end</nowiki> "ie you get POLLIN with a zero length read(). SO_KEEPALIVE won't be involved. Now if you down the network interface you should eventually get the POLLHUP." | |||
<nowiki>https://bugs.dragonflybsd.org/issues/3268</nowiki> pipes don't do POLLHUP BUG | |||
== Test code == | == Test code == |