summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandre <andre@FreeBSD.org>2012-10-19 12:16:29 +0000
committerandre <andre@FreeBSD.org>2012-10-19 12:16:29 +0000
commitb521bc0b760a90ba5628d99230fd30afa7b12b37 (patch)
treec0cda8c5a210f205ff0e19d15cd75fe0060b5b8c
parent14f96abc23e12f234deebbdce4be1fceb3876c7e (diff)
downloadFreeBSD-src-b521bc0b760a90ba5628d99230fd30afa7b12b37.zip
FreeBSD-src-b521bc0b760a90ba5628d99230fd30afa7b12b37.tar.gz
Move socket UMA zone initialization functionality together into
one place.
-rw-r--r--sys/kern/uipc_socket.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 2939be1..b31bdae 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -173,11 +173,8 @@ static struct filterops sowrite_filtops = {
.f_event = filt_sowrite,
};
-uma_zone_t socket_zone;
so_gen_t so_gencnt; /* generation count for sockets */
-int maxsockets;
-
MALLOC_DEFINE(M_SONAME, "soname", "socket name");
MALLOC_DEFINE(M_PCB, "pcb", "protocol control block");
@@ -230,6 +227,9 @@ SYSCTL_NODE(_kern, KERN_IPC, ipc, CTLFLAG_RW, 0, "IPC");
* Initialize the socket subsystem and set up the socket
* memory allocator.
*/
+uma_zone_t socket_zone;
+int maxsockets;
+
static void
socket_zone_change(void *tag)
{
@@ -250,6 +250,19 @@ socket_init(void *tag)
SYSINIT(socket, SI_SUB_PROTO_DOMAININIT, SI_ORDER_ANY, socket_init, NULL);
/*
+ * Initialise maxsockets. This SYSINIT must be run after
+ * tunable_mbinit().
+ */
+static void
+init_maxsockets(void *ignored)
+{
+
+ TUNABLE_INT_FETCH("kern.ipc.maxsockets", &maxsockets);
+ maxsockets = imax(maxsockets, imax(maxfiles, nmbclusters));
+}
+SYSINIT(param, SI_SUB_TUNABLES, SI_ORDER_ANY, init_maxsockets, NULL);
+
+/*
* Sysctl to get and set the maximum global sockets limit. Notify protocols
* of the change so that they can update their dependent limits as required.
*/
@@ -273,25 +286,11 @@ sysctl_maxsockets(SYSCTL_HANDLER_ARGS)
}
return (error);
}
-
SYSCTL_PROC(_kern_ipc, OID_AUTO, maxsockets, CTLTYPE_INT|CTLFLAG_RW,
&maxsockets, 0, sysctl_maxsockets, "IU",
"Maximum number of sockets avaliable");
/*
- * Initialise maxsockets. This SYSINIT must be run after
- * tunable_mbinit().
- */
-static void
-init_maxsockets(void *ignored)
-{
-
- TUNABLE_INT_FETCH("kern.ipc.maxsockets", &maxsockets);
- maxsockets = imax(maxsockets, imax(maxfiles, nmbclusters));
-}
-SYSINIT(param, SI_SUB_TUNABLES, SI_ORDER_ANY, init_maxsockets, NULL);
-
-/*
* Socket operation routines. These routines are called by the routines in
* sys_socket.c or from a system process, and implement the semantics of
* socket operations by switching out to the protocol specific routines.
OpenPOWER on IntegriCloud