summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2011-03-14 01:06:21 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2011-03-14 01:06:21 +0000
commitf7751ddd1eadd4fe6662988bb95eb61672a6c067 (patch)
treed69e7a67df0db530c2ad1b459ce5b9c3dc5ba14c /sys
parente16b0fb46406df6bf6b1cd8b228e052355c2bf32 (diff)
When a process reads from a spliced socket that already got an
end-of-file but still has data in the receive buffer, soreceive() should block until all data has been moved. To make kqueue work with socket splicing, it has to report spliced sockets as non-readable. ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/uipc_socket.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 09a0189ca77..926a2d892d2 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket.c,v 1.87 2011/03/12 18:31:41 bluhm Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.88 2011/03/14 01:06:20 bluhm Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@@ -650,7 +650,7 @@ restart:
if (so->so_state & SS_CANTRCVMORE) {
if (m)
goto dontblock;
- else
+ else if (so->so_rcv.sb_cc == 0)
goto release;
}
for (; m; m = m->m_next)
@@ -1633,6 +1633,10 @@ filt_soread(struct knote *kn, long hint)
struct socket *so = (struct socket *)kn->kn_fp->f_data;
kn->kn_data = so->so_rcv.sb_cc;
+#ifdef SOCKET_SPLICE
+ if (so->so_splice)
+ return (0);
+#endif /* SOCKET_SPLICE */
if (so->so_state & SS_CANTRCVMORE) {
kn->kn_flags |= EV_EOF;
kn->kn_fflags = so->so_error;