Hi,

I have two more socket splicing fixes.

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.  Note that (so->so_rcv.sb_cc
== 0) can only be false, if splicing is active.  Otherwise it would
panic a few lines above.

To make kqueue work with socket splicing, it has to report spliced
sockets as non-readable.

ok?

bluhm


Index: kern/uipc_socket.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/kern/uipc_socket.c,v
retrieving revision 1.87
diff -u -p -r1.87 uipc_socket.c
--- kern/uipc_socket.c  12 Mar 2011 18:31:41 -0000      1.87
+++ kern/uipc_socket.c  12 Mar 2011 22:41:27 -0000
@@ -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 +1637,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;

Reply via email to