summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpst <pst@FreeBSD.org>1996-09-19 00:54:36 +0000
committerpst <pst@FreeBSD.org>1996-09-19 00:54:36 +0000
commit59ab34c158aede507215c7d91314d593c571de8c (patch)
tree6c8805e0a60bcf51b28c35977794a4cf4ddcd02e
parentba02dd81ba2919a2ed6bc2b3b635aabf6c153a39 (diff)
downloadFreeBSD-src-59ab34c158aede507215c7d91314d593c571de8c.zip
FreeBSD-src-59ab34c158aede507215c7d91314d593c571de8c.tar.gz
Add a new sysctl variable kern.sominqueue to override the MINIMUM queue
specified in a listen(2) system call.
-rw-r--r--sys/kern/uipc_sockbuf.c8
-rw-r--r--sys/kern/uipc_socket2.c8
-rw-r--r--sys/sys/sysctl.h6
3 files changed, 16 insertions, 6 deletions
diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c
index 1a79d87..0590034 100644
--- a/sys/kern/uipc_sockbuf.c
+++ b/sys/kern/uipc_sockbuf.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)uipc_socket2.c 8.1 (Berkeley) 6/10/93
- * $Id: uipc_socket2.c,v 1.12 1996/07/11 16:31:59 wollman Exp $
+ * $Id: uipc_socket2.c,v 1.13 1996/08/19 19:22:26 julian Exp $
*/
#include <sys/param.h>
@@ -60,6 +60,9 @@ static u_long sb_efficiency = 8; /* parameter for sbreserve() */
SYSCTL_INT(_kern, OID_AUTO, sockbuf_waste_factor, CTLFLAG_RW, &sb_efficiency,
0, "");
+static int sominqueue = 0;
+SYSCTL_INT(_kern, KERN_SOMINQUEUE, sominqueue, CTLFLAG_RW, &sominqueue, 0, "");
+
/*
* Procedures to manipulate state flags of socket
* and do appropriate wakeups. Normal sequence from the
@@ -163,7 +166,8 @@ sonewconn1(head, connstatus)
{
register struct socket *so;
- if (head->so_qlen > 3 * head->so_qlimit / 2)
+ if ((head->so_qlen > 3 * head->so_qlimit / 2) &&
+ (head->so_qlen > sominqueue))
return ((struct socket *)0);
MALLOC(so, struct socket *, sizeof(*so), M_SOCKET, M_DONTWAIT);
if (so == NULL)
diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c
index 1a79d87..0590034 100644
--- a/sys/kern/uipc_socket2.c
+++ b/sys/kern/uipc_socket2.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)uipc_socket2.c 8.1 (Berkeley) 6/10/93
- * $Id: uipc_socket2.c,v 1.12 1996/07/11 16:31:59 wollman Exp $
+ * $Id: uipc_socket2.c,v 1.13 1996/08/19 19:22:26 julian Exp $
*/
#include <sys/param.h>
@@ -60,6 +60,9 @@ static u_long sb_efficiency = 8; /* parameter for sbreserve() */
SYSCTL_INT(_kern, OID_AUTO, sockbuf_waste_factor, CTLFLAG_RW, &sb_efficiency,
0, "");
+static int sominqueue = 0;
+SYSCTL_INT(_kern, KERN_SOMINQUEUE, sominqueue, CTLFLAG_RW, &sominqueue, 0, "");
+
/*
* Procedures to manipulate state flags of socket
* and do appropriate wakeups. Normal sequence from the
@@ -163,7 +166,8 @@ sonewconn1(head, connstatus)
{
register struct socket *so;
- if (head->so_qlen > 3 * head->so_qlimit / 2)
+ if ((head->so_qlen > 3 * head->so_qlimit / 2) &&
+ (head->so_qlen > sominqueue))
return ((struct socket *)0);
MALLOC(so, struct socket *, sizeof(*so), M_SOCKET, M_DONTWAIT);
if (so == NULL)
diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h
index fb998dd..78575a7 100644
--- a/sys/sys/sysctl.h
+++ b/sys/sys/sysctl.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)sysctl.h 8.1 (Berkeley) 6/2/93
- * $Id: sysctl.h,v 1.43 1996/07/25 18:02:14 wollman Exp $
+ * $Id: sysctl.h,v 1.44 1996/09/10 23:31:13 bde Exp $
*/
#ifndef _SYS_SYSCTL_H_
@@ -223,7 +223,8 @@ int sysctl_handle_opaque SYSCTL_HANDLER_ARGS;
#define KERN_MAXSOCKBUF 31 /* int: max size of a socket buffer */
#define KERN_PS_STRINGS 32 /* int: address of PS_STRINGS */
#define KERN_USRSTACK 33 /* int: address of USRSTACK */
-#define KERN_MAXID 34 /* number of valid kern ids */
+#define KERN_SOMINQUEUE 34 /* int: override socket listen() */
+#define KERN_MAXID 35 /* number of valid kern ids */
#define CTL_KERN_NAMES { \
{ 0, 0 }, \
@@ -260,6 +261,7 @@ int sysctl_handle_opaque SYSCTL_HANDLER_ARGS;
{ "maxsockbuf", CTLTYPE_INT }, \
{ "ps_strings", CTLTYPE_INT }, \
{ "usrstack", CTLTYPE_INT }, \
+ { "sominqueue", CTLTYPE_INT }, \
}
/*
OpenPOWER on IntegriCloud