From owner-freebsd-current Sun Feb 14 23:21:34 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id XAA17001 for freebsd-current-outgoing; Sun, 14 Feb 1999 23:21:34 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from alpha.xerox.com (alpha.Xerox.COM [13.1.64.93]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id XAA16996 for ; Sun, 14 Feb 1999 23:21:31 -0800 (PST) (envelope-from fenner@parc.xerox.com) Received: from mango.parc.xerox.com ([13.1.102.232]) by alpha.xerox.com with SMTP id <53196(1)>; Sun, 14 Feb 1999 23:21:18 PST Received: from mango.parc.xerox.com (localhost.parc.xerox.com [127.0.0.1]) by mango.parc.xerox.com (8.8.8/8.8.8) with ESMTP id XAA15264; Sun, 14 Feb 1999 23:21:14 -0800 (PST) (envelope-from fenner@mango.parc.xerox.com) Message-Id: <199902150721.XAA15264@mango.parc.xerox.com> To: Matthew Dillon cc: Bruce Evans , freebsd-current@FreeBSD.ORG Subject: Re: Weird piecemeal reads over socketpair() pipe breaks up small writes into even smaller reads. In-reply-to: Your message of "Sun, 14 Feb 1999 22:41:56 PST." <199902150641.WAA12845@apollo.backplane.com> Date: Sun, 14 Feb 1999 23:21:14 PST From: Bill Fenner Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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