Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Jul 1999 16:18:19 -0700 (PDT)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        "Jason Young" <doogie@anet-stl.com>, "Papezik Milon" <papezik@pvt.net>, <hackers@FreeBSD.ORG>
Subject:   New patch fpr uipc_socket.c (was Squid - a bug in src/sys/kern/uipc_socket.c)
Message-ID:  <199907222318.QAA17973@apollo.backplane.com>
References:  <000501bed48b$3de34600$8a9791d1@y> <199907222200.PAA88061@apollo.backplane.com> <199907222210.PAA88151@apollo.backplane.com>

next in thread | previous in thread | raw e-mail | index | archive | help
    I believe this will solve the previously reported problems.

    With the original patch if I set net.inet.tcp.sendspace=63 and tried 
    to run xterm from that machine to my local workstation, I got an X error.
    If I set sendspace=31 the xterm process just locked up and did nothing
    until I ^C'd it.

	machine A			machine B
	w/modified kernel		w/unmodified kernel
	(sysctl's on this machine)

	xterm run on A		-->	display is on B

    With this patch I can set net.inet.tcp.sendspace to anything (63, 31, 1,
    whatever I want) and the xterm will still run.  And yes, the xterm is
    amazingly slow when I set net.inet.tcp.sendspace to 1 :-)

    This patch is relative to -CURRENT but should also work with -STABLE.
	
						-Matt

Index: uipc_socket.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/uipc_socket.c,v
retrieving revision 1.60
diff -u -r1.60 uipc_socket.c
--- uipc_socket.c	1999/06/17 23:54:47	1.60
+++ uipc_socket.c	1999/07/22 23:08:38
@@ -413,7 +413,8 @@
 	register struct mbuf *m;
 	register long space, len, resid;
 	int clen = 0, error, s, dontroute, mlen;
-	int atomic = sosendallatonce(so) || top;
+	int atomic = sosendallatonce(so) || top;	/* required atomicy */
+	int try_atomic = atomic;			/* requested atomicy */
 
 	if (uio)
 		resid = uio->uio_resid;
@@ -518,6 +519,7 @@
 				mlen = MCLBYTES;
 				len = min(min(mlen, resid), space);
 			} else {
+				try_atomic = 1;		/* try to optimize */
 nopages:
 				len = min(min(mlen, resid), space);
 				/*
@@ -541,7 +543,7 @@
 					top->m_flags |= M_EOR;
 				break;
 			}
-		    } while (space > 0 && atomic);
+		    } while (space > 0 && try_atomic);
 		    if (dontroute)
 			    so->so_options |= SO_DONTROUTE;
 		    s = splnet();				/* XXX */


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




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