summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2006-03-26 22:44:37 +0000
committerrwatson <rwatson@FreeBSD.org>2006-03-26 22:44:37 +0000
commitebefd0941153ad65b8e1e9ce6921455e33c8caa8 (patch)
treeee30ac31e494ef573bf1da800de0aa3811ecf63a
parent4aeee474e68d6e6cd3a6b373d368d90c57cd0f9a (diff)
downloadFreeBSD-src-ebefd0941153ad65b8e1e9ce6921455e33c8caa8.zip
FreeBSD-src-ebefd0941153ad65b8e1e9ce6921455e33c8caa8.tar.gz
Add a sysctl, regression.sonewconn_earlytest, which when options
REGRESSION is enabled, allows user space to dictate that sonewconn() should skip it's "skip the hard work" check to see if the listen queue is full, and instead proceed with allocation of a socket and trimming of the overflowed queue. This makes it easier to test the queue overflow logic. MFC after: 1 month
-rw-r--r--sys/kern/uipc_sockbuf.c10
-rw-r--r--sys/kern/uipc_socket2.c10
2 files changed, 20 insertions, 0 deletions
diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c
index bdeb344..32f3b8c 100644
--- a/sys/kern/uipc_sockbuf.c
+++ b/sys/kern/uipc_sockbuf.c
@@ -70,6 +70,12 @@ static u_long sb_max_adj =
static u_long sb_efficiency = 8; /* parameter for sbreserve() */
+#ifdef REGRESSION
+static int regression_sonewconn_earlytest = 1;
+SYSCTL_INT(_regression, OID_AUTO, sonewconn_earlytest, CTLFLAG_RW,
+ &regression_sonewconn_earlytest, 0, "Perform early sonewconn limit test");
+#endif
+
/*
* Procedures to manipulate state flags of socket
* and do appropriate wakeups. Normal sequence from the
@@ -215,7 +221,11 @@ sonewconn(head, connstatus)
ACCEPT_LOCK();
over = (head->so_qlen > 3 * head->so_qlimit / 2);
ACCEPT_UNLOCK();
+#ifdef REGRESSION
+ if (regression_sonewconn_earlytest && over)
+#else
if (over)
+#endif
return (NULL);
so = soalloc(M_NOWAIT);
if (so == NULL)
diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c
index bdeb344..32f3b8c 100644
--- a/sys/kern/uipc_socket2.c
+++ b/sys/kern/uipc_socket2.c
@@ -70,6 +70,12 @@ static u_long sb_max_adj =
static u_long sb_efficiency = 8; /* parameter for sbreserve() */
+#ifdef REGRESSION
+static int regression_sonewconn_earlytest = 1;
+SYSCTL_INT(_regression, OID_AUTO, sonewconn_earlytest, CTLFLAG_RW,
+ &regression_sonewconn_earlytest, 0, "Perform early sonewconn limit test");
+#endif
+
/*
* Procedures to manipulate state flags of socket
* and do appropriate wakeups. Normal sequence from the
@@ -215,7 +221,11 @@ sonewconn(head, connstatus)
ACCEPT_LOCK();
over = (head->so_qlen > 3 * head->so_qlimit / 2);
ACCEPT_UNLOCK();
+#ifdef REGRESSION
+ if (regression_sonewconn_earlytest && over)
+#else
if (over)
+#endif
return (NULL);
so = soalloc(M_NOWAIT);
if (so == NULL)
OpenPOWER on IntegriCloud