Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Feb 1999 23:21:14 PST
From:      Bill Fenner <fenner@parc.xerox.com>
To:        Matthew Dillon <dillon@apollo.backplane.com>
Cc:        Bruce Evans <bde@zeta.org.au>, freebsd-current@FreeBSD.ORG
Subject:   Re: Weird piecemeal reads over socketpair() pipe breaks up small writes into even smaller reads. 
Message-ID:  <199902150721.XAA15264@mango.parc.xerox.com>
In-Reply-To: Your message of "Sun, 14 Feb 1999 22:41:56 PST." <199902150641.WAA12845@apollo.backplane.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
How about a 1-line fix:

Index: uipc_usrreq.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/uipc_usrreq.c,v
retrieving revision 1.37
diff -u -r1.37 uipc_usrreq.c
--- uipc_usrreq.c	1998/10/25 17:44:51	1.37
+++ uipc_usrreq.c	1999/02/15 07:09:12
@@ -348,7 +348,8 @@
 		unp->unp_conn->unp_mbcnt = rcv->sb_mbcnt;
 		snd->sb_hiwat -= rcv->sb_cc - unp->unp_conn->unp_cc;
 		unp->unp_conn->unp_cc = rcv->sb_cc;
-		sorwakeup(so2);
+		if (!(flags & PRUS_MORETOCOME))
+			sorwakeup(so2);
 		m = 0;
 #undef snd
 #undef rcv

Unfortunately, this apparently unearths a bug in the ?:?:?:
expression in sosend(), so try this diff too.

Index: uipc_socket.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/uipc_socket.c,v
retrieving revision 1.51
diff -u -r1.51 uipc_socket.c
--- uipc_socket.c	1999/01/20 17:45:22	1.51
+++ uipc_socket.c	1999/02/15 07:09:25
@@ -388,6 +405,7 @@
 	register long space, len, resid;
 	int clen = 0, error, s, dontroute, mlen;
 	int atomic = sosendallatonce(so) || top;
+	int pru_flags;
 
 	if (uio)
 		resid = uio->uio_resid;
@@ -518,21 +536,24 @@
 		    } while (space > 0 && atomic);
 		    if (dontroute)
 			    so->so_options |= SO_DONTROUTE;
+		    pru_flags = 0;
+		    if (flags & MSG_OOB)
+			pru_flags |= PRUS_OOB;
+		    /*
+		     * If the user set MSG_EOF, the protocol
+		     * understands this flag and nothing left to
+		     * send then set PRUS_EOF.
+		     */
+		    if ((flags & MSG_EOF) &&
+			(so->so_proto->pr_flags & PR_IMPLOPCL) &&
+			(resid <= 0))
+			pru_flags |= PRUS_EOF;
+		    /* If there is more to send set PRUS_MORETOCOME */
+		    if (resid > 0 && space > 0)
+			pru_flags |= PRUS_MORETOCOME;
 		    s = splnet();				/* XXX */
 		    error = (*so->so_proto->pr_usrreqs->pru_send)(so,
-			(flags & MSG_OOB) ? PRUS_OOB :
-			/*
-			 * If the user set MSG_EOF, the protocol
-			 * understands this flag and nothing left to
-			 * send then use PRU_SEND_EOF instead of PRU_SEND.
-			 */
-			((flags & MSG_EOF) &&
-			 (so->so_proto->pr_flags & PR_IMPLOPCL) &&
-			 (resid <= 0)) ?
-				PRUS_EOF :
-			/* If there is more to send set PRUS_MORETOCOME */
-			(resid > 0 && space > 0) ? PRUS_MORETOCOME : 0,
-			top, addr, control, p);
+			pru_flags, top, addr, control, p);
 		    splx(s);
 		    if (dontroute)
 			    so->so_options &= ~SO_DONTROUTE;


  Bill

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199902150721.XAA15264>