diff options
author | kib <kib@FreeBSD.org> | 2009-08-23 12:44:15 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2009-08-23 12:44:15 +0000 |
commit | 8b1803af930eeefcd9b18b562e0ea5a2ac730837 (patch) | |
tree | 1af9e01d3fbffe5051806f83dd7d429992c00cd0 /sys/kern/uipc_socket.c | |
parent | 070a590e2dab584cfe1b087e3a4ff26742654ea9 (diff) | |
download | FreeBSD-src-8b1803af930eeefcd9b18b562e0ea5a2ac730837.zip FreeBSD-src-8b1803af930eeefcd9b18b562e0ea5a2ac730837.tar.gz |
Fix the conformance of poll(2) for sockets after r195423 by
returning POLLHUP instead of POLLIN for several cases. Now, the
tools/regression/poll results for FreeBSD are closer to that of the
Solaris and Linux.
Also, improve the POSIX conformance by explicitely clearing POLLOUT
when POLLHUP is reported in pollscan(), making the fix global.
Submitted by: bde
Reviewed by: rwatson
MFC after: 1 week
Diffstat (limited to 'sys/kern/uipc_socket.c')
-rw-r--r-- | sys/kern/uipc_socket.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 2f4dd92..c60b8d1 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -2898,13 +2898,11 @@ sopoll_generic(struct socket *so, int events, struct ucred *active_cred, if (so->so_oobmark || (so->so_rcv.sb_state & SBS_RCVATMARK)) revents |= events & (POLLPRI | POLLRDBAND); - if ((events & POLLINIGNEOF) == 0) { - if (so->so_rcv.sb_state & SBS_CANTRCVMORE) { - revents |= events & (POLLIN | POLLRDNORM); - if (so->so_snd.sb_state & SBS_CANTSENDMORE) - revents |= POLLHUP; - } - } + if ((events & POLLINIGNEOF) == 0) + if (so->so_rcv.sb_state & SBS_CANTRCVMORE) + revents |= POLLHUP; + if (so->so_snd.sb_state & SBS_CANTSENDMORE) + revents |= POLLHUP; if (revents == 0) { if (events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) { |