summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_socket2.c
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>1999-07-05 08:52:54 +0000
committermsmith <msmith@FreeBSD.org>1999-07-05 08:52:54 +0000
commitaf7615d39a0a05294c977a44b96e0abd75a0e723 (patch)
treed39acb1756b5a1342da8e9e7436ed7232c818bf1 /sys/kern/uipc_socket2.c
parent36e6752409ff0942f4248605bd0089086ffb9dfe (diff)
downloadFreeBSD-src-af7615d39a0a05294c977a44b96e0abd75a0e723.zip
FreeBSD-src-af7615d39a0a05294c977a44b96e0abd75a0e723.tar.gz
Move the initialisation/tuning of nmbclusters from param.c/machdep.c
into uipc_mbuf.c. This reduces three sets of identical tunable code to one set, and puts the initialisation with the mbuf code proper. Make NMBUFs tunable as well. Move the nmbclusters sysctl here as well. Move the initialisation of maxsockets from param.c to uipc_socket2.c, next to its corresponding sysctl. Use the new tunable macros for the kern.vm.kmem.size tunable (this should have been in a separate commit, whoops).
Diffstat (limited to 'sys/kern/uipc_socket2.c')
-rw-r--r--sys/kern/uipc_socket2.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c
index 2583e3b..14d73c3 100644
--- a/sys/kern/uipc_socket2.c
+++ b/sys/kern/uipc_socket2.c
@@ -31,12 +31,14 @@
* SUCH DAMAGE.
*
* @(#)uipc_socket2.c 8.1 (Berkeley) 6/10/93
- * $Id: uipc_socket2.c,v 1.46 1999/05/10 18:15:40 peter Exp $
+ * $Id: uipc_socket2.c,v 1.47 1999/06/17 23:54:48 green Exp $
*/
+#include "opt_param.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/domain.h>
+#include <sys/file.h> /* for maxfiles */
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/malloc.h>
@@ -48,6 +50,8 @@
#include <sys/signalvar.h>
#include <sys/sysctl.h>
+int maxsockets;
+
/*
* Primitive routines for operating on sockets and socket buffers
*/
@@ -954,6 +958,13 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, maxsockets, CTLFLAG_RD,
&maxsockets, 0, "Maximum number of sockets avaliable");
SYSCTL_INT(_kern_ipc, KIPC_SOCKBUF_WASTE, sockbuf_waste_factor, CTLFLAG_RW,
&sb_efficiency, 0, "");
-SYSCTL_INT(_kern_ipc, KIPC_NMBCLUSTERS, nmbclusters, CTLFLAG_RD,
- &nmbclusters, 0, "Maximum number of mbuf clusters avaliable");
+/*
+ * Initialise maxsockets
+ */
+static void init_maxsockets(void *ignored)
+{
+ TUNABLE_INT_FETCH("kern.ipc.maxsockets", 0, maxsockets);
+ maxsockets = imax(maxsockets, imax(maxfiles, nmbclusters));
+}
+SYSINIT(param, SI_SUB_TUNABLES, SI_ORDER_ANY, init_maxsockets, NULL);
OpenPOWER on IntegriCloud