summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_socket.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2009-08-23 12:44:15 +0000
committerkib <kib@FreeBSD.org>2009-08-23 12:44:15 +0000
commit8b1803af930eeefcd9b18b562e0ea5a2ac730837 (patch)
tree1af9e01d3fbffe5051806f83dd7d429992c00cd0 /sys/kern/uipc_socket.c
parent070a590e2dab584cfe1b087e3a4ff26742654ea9 (diff)
downloadFreeBSD-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.c12
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)) {
OpenPOWER on IntegriCloud