Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern put all kern socket sysctls in the same place
details: https://anonhg.NetBSD.org/src/rev/0d38ef572f22
branches: trunk
changeset: 781943:0d38ef572f22
user: pooka <pooka%NetBSD.org@localhost>
date: Mon Oct 08 19:20:45 2012 +0000
description:
put all kern socket sysctls in the same place
diffstat:
sys/kern/init_sysctl.c | 35 ++---------------------------------
sys/kern/uipc_socket.c | 42 +++++++++++++++++++++++++++++++++++++-----
2 files changed, 39 insertions(+), 38 deletions(-)
diffs (160 lines):
diff -r 586a6f695b57 -r 0d38ef572f22 sys/kern/init_sysctl.c
--- a/sys/kern/init_sysctl.c Mon Oct 08 18:20:34 2012 +0000
+++ b/sys/kern/init_sysctl.c Mon Oct 08 19:20:45 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: init_sysctl.c,v 1.191 2012/10/03 07:22:59 mlelstv Exp $ */
+/* $NetBSD: init_sysctl.c,v 1.192 2012/10/08 19:20:45 pooka Exp $ */
/*-
* Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.191 2012/10/03 07:22:59 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.192 2012/10/08 19:20:45 pooka Exp $");
#include "opt_sysv.h"
#include "opt_compat_netbsd.h"
@@ -156,7 +156,6 @@
#if NPTY > 0
static int sysctl_kern_maxptys(SYSCTLFN_PROTO);
#endif /* NPTY > 0 */
-static int sysctl_kern_sbmax(SYSCTLFN_PROTO);
static int sysctl_kern_urnd(SYSCTLFN_PROTO);
static int sysctl_kern_arnd(SYSCTLFN_PROTO);
static int sysctl_kern_lwp(SYSCTLFN_PROTO);
@@ -536,12 +535,6 @@
NULL, MAXPHYS, NULL, 0,
CTL_KERN, KERN_MAXPHYS, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
- CTLTYPE_INT, "sbmax",
- SYSCTL_DESCR("Maximum socket buffer size"),
- sysctl_kern_sbmax, 0, NULL, 0,
- CTL_KERN, KERN_SBMAX, CTL_EOL);
- sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
CTLTYPE_INT, "monotonic_clock",
SYSCTL_DESCR("Implementation version of the POSIX "
@@ -1350,30 +1343,6 @@
#endif /* NPTY > 0 */
/*
- * sysctl helper routine for kern.sbmax. Basically just ensures that
- * any new value is not too small.
- */
-static int
-sysctl_kern_sbmax(SYSCTLFN_ARGS)
-{
- int error, new_sbmax;
- struct sysctlnode node;
-
- new_sbmax = sb_max;
- node = *rnode;
- node.sysctl_data = &new_sbmax;
- error = sysctl_lookup(SYSCTLFN_CALL(&node));
- if (error || newp == NULL)
- return (error);
-
- KERNEL_LOCK(1, NULL);
- error = sb_max_set(new_sbmax);
- KERNEL_UNLOCK_ONE(NULL);
-
- return (error);
-}
-
-/*
* sysctl helper routine for kern.urandom node. Picks a random number
* for you.
*/
diff -r 586a6f695b57 -r 0d38ef572f22 sys/kern/uipc_socket.c
--- a/sys/kern/uipc_socket.c Mon Oct 08 18:20:34 2012 +0000
+++ b/sys/kern/uipc_socket.c Mon Oct 08 19:20:45 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_socket.c,v 1.211 2012/07/09 04:35:13 chs Exp $ */
+/* $NetBSD: uipc_socket.c,v 1.212 2012/10/08 19:20:45 pooka Exp $ */
/*-
* Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.211 2012/07/09 04:35:13 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.212 2012/10/08 19:20:45 pooka Exp $");
#include "opt_compat_netbsd.h"
#include "opt_sock_counters.h"
@@ -160,7 +160,7 @@
static kcondvar_t pendfree_thread_cv;
static lwp_t *sopendfree_lwp;
-static void sysctl_kern_somaxkva_setup(void);
+static void sysctl_kern_socket_setup(void);
static struct sysctllog *socket_sysctllog;
static vsize_t
@@ -453,7 +453,7 @@
soinit(void)
{
- sysctl_kern_somaxkva_setup();
+ sysctl_kern_socket_setup();
mutex_init(&so_pendfree_lock, MUTEX_DEFAULT, IPL_VM);
softnet_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
@@ -2366,6 +2366,7 @@
#include <sys/sysctl.h>
static int sysctl_kern_somaxkva(SYSCTLFN_PROTO);
+static int sysctl_kern_sbmax(SYSCTLFN_PROTO);
/*
* sysctl helper routine for kern.somaxkva. ensures that the given
@@ -2396,8 +2397,32 @@
return (error);
}
+/*
+ * sysctl helper routine for kern.sbmax. Basically just ensures that
+ * any new value is not too small.
+ */
+static int
+sysctl_kern_sbmax(SYSCTLFN_ARGS)
+{
+ int error, new_sbmax;
+ struct sysctlnode node;
+
+ new_sbmax = sb_max;
+ node = *rnode;
+ node.sysctl_data = &new_sbmax;
+ error = sysctl_lookup(SYSCTLFN_CALL(&node));
+ if (error || newp == NULL)
+ return (error);
+
+ KERNEL_LOCK(1, NULL);
+ error = sb_max_set(new_sbmax);
+ KERNEL_UNLOCK_ONE(NULL);
+
+ return (error);
+}
+
static void
-sysctl_kern_somaxkva_setup(void)
+sysctl_kern_socket_setup(void)
{
KASSERT(socket_sysctllog == NULL);
@@ -2414,4 +2439,11 @@
"used for socket buffers"),
sysctl_kern_somaxkva, 0, NULL, 0,
CTL_KERN, KERN_SOMAXKVA, CTL_EOL);
+
+ sysctl_createv(&socket_sysctllog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+ CTLTYPE_INT, "sbmax",
+ SYSCTL_DESCR("Maximum socket buffer size"),
+ sysctl_kern_sbmax, 0, NULL, 0,
+ CTL_KERN, KERN_SBMAX, CTL_EOL);
}
Home |
Main Index |
Thread Index |
Old Index