Feed dust to a few linkset uses and explicitly call the constructor.

This commit is contained in:
pooka 2010-05-26 23:53:21 +00:00
parent a5a3d4c202
commit f0c67b0751
3 changed files with 48 additions and 29 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_module.c,v 1.68 2010/05/24 16:37:17 pgoyette Exp $ */
/* $NetBSD: kern_module.c,v 1.69 2010/05/26 23:53:21 pooka Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.68 2010/05/24 16:37:17 pgoyette Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.69 2010/05/26 23:53:21 pooka Exp $");
#define _MODULE_INTERNAL
@ -99,6 +99,8 @@ static void module_enqueue(module_t *);
static bool module_merge_dicts(prop_dictionary_t, const prop_dictionary_t);
static void sysctl_module_setup(void);
/*
* module_error:
*
@ -328,6 +330,8 @@ module_init(void)
module_error("builtin %s failed: %d\n",
(*mip)->mi_name, rv);
}
sysctl_module_setup();
}
/*
@ -346,16 +350,19 @@ module_init2(void)
panic("module_init: %d", error);
}
SYSCTL_SETUP(sysctl_module_setup, "sysctl module setup")
static struct sysctllog *module_sysctllog;
static void
sysctl_module_setup(void)
{
const struct sysctlnode *node = NULL;
sysctl_createv(clog, 0, NULL, NULL,
sysctl_createv(&module_sysctllog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "kern", NULL,
NULL, 0, NULL, 0,
CTL_KERN, CTL_EOL);
sysctl_createv(clog, 0, NULL, &node,
sysctl_createv(&module_sysctllog, 0, NULL, &node,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "module",
SYSCTL_DESCR("Module options"),
@ -365,13 +372,13 @@ SYSCTL_SETUP(sysctl_module_setup, "sysctl module setup")
if (node == NULL)
return;
sysctl_createv(clog, 0, &node, NULL,
sysctl_createv(&module_sysctllog, 0, &node, NULL,
CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
CTLTYPE_BOOL, "autoload",
SYSCTL_DESCR("Enable automatic load of modules"),
NULL, 0, &module_autoload_on, 0,
CTL_CREATE, CTL_EOL);
sysctl_createv(clog, 0, &node, NULL,
sysctl_createv(&module_sysctllog, 0, &node, NULL,
CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
CTLTYPE_BOOL, "verbose",
SYSCTL_DESCR("Enable verbose output"),

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_resource.c,v 1.155 2010/03/03 00:47:30 yamt Exp $ */
/* $NetBSD: kern_resource.c,v 1.156 2010/05/26 23:53:21 pooka Exp $ */
/*-
* Copyright (c) 1982, 1986, 1991, 1993
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_resource.c,v 1.155 2010/03/03 00:47:30 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_resource.c,v 1.156 2010/05/26 23:53:21 pooka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -71,6 +71,8 @@ static pool_cache_t pstats_cache;
static kauth_listener_t resource_listener;
static void sysctl_proc_setup(void);
static int
resource_listener_cb(kauth_cred_t cred, kauth_action_t action, void *cookie,
void *arg0, void *arg1, void *arg2, void *arg3)
@ -145,6 +147,8 @@ resource_init(void)
resource_listener = kauth_listen_scope(KAUTH_SCOPE_PROCESS,
resource_listener_cb, NULL);
sysctl_proc_setup();
}
/*
@ -1003,31 +1007,34 @@ sysctl_proc_plimit(SYSCTLFN_ARGS)
return (dosetrlimit(l, ptmp, limitno, &alim));
}
static struct sysctllog *proc_sysctllog;
/*
* and finally, the actually glue that sticks it to the tree
*/
SYSCTL_SETUP(sysctl_proc_setup, "sysctl proc subtree setup")
static void
sysctl_proc_setup()
{
sysctl_createv(clog, 0, NULL, NULL,
sysctl_createv(&proc_sysctllog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "proc", NULL,
NULL, 0, NULL, 0,
CTL_PROC, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
sysctl_createv(&proc_sysctllog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_ANYNUMBER,
CTLTYPE_NODE, "curproc",
SYSCTL_DESCR("Per-process settings"),
NULL, 0, NULL, 0,
CTL_PROC, PROC_CURPROC, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
sysctl_createv(&proc_sysctllog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE|CTLFLAG_ANYWRITE,
CTLTYPE_STRING, "corename",
SYSCTL_DESCR("Core file name"),
sysctl_proc_corename, 0, NULL, MAXPATHLEN,
CTL_PROC, PROC_CURPROC, PROC_PID_CORENAME, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
sysctl_createv(&proc_sysctllog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "rlimit",
SYSCTL_DESCR("Process limits"),
@ -1035,21 +1042,21 @@ SYSCTL_SETUP(sysctl_proc_setup, "sysctl proc subtree setup")
CTL_PROC, PROC_CURPROC, PROC_PID_LIMIT, CTL_EOL);
#define create_proc_plimit(s, n) do { \
sysctl_createv(clog, 0, NULL, NULL, \
sysctl_createv(&proc_sysctllog, 0, NULL, NULL, \
CTLFLAG_PERMANENT, \
CTLTYPE_NODE, s, \
SYSCTL_DESCR("Process " s " limits"), \
NULL, 0, NULL, 0, \
CTL_PROC, PROC_CURPROC, PROC_PID_LIMIT, n, \
CTL_EOL); \
sysctl_createv(clog, 0, NULL, NULL, \
sysctl_createv(&proc_sysctllog, 0, NULL, NULL, \
CTLFLAG_PERMANENT|CTLFLAG_READWRITE|CTLFLAG_ANYWRITE, \
CTLTYPE_QUAD, "soft", \
SYSCTL_DESCR("Process soft " s " limit"), \
sysctl_proc_plimit, 0, NULL, 0, \
CTL_PROC, PROC_CURPROC, PROC_PID_LIMIT, n, \
PROC_PID_LIMIT_TYPE_SOFT, CTL_EOL); \
sysctl_createv(clog, 0, NULL, NULL, \
sysctl_createv(&proc_sysctllog, 0, NULL, NULL, \
CTLFLAG_PERMANENT|CTLFLAG_READWRITE|CTLFLAG_ANYWRITE, \
CTLTYPE_QUAD, "hard", \
SYSCTL_DESCR("Process hard " s " limit"), \
@ -1072,19 +1079,19 @@ SYSCTL_SETUP(sysctl_proc_setup, "sysctl proc subtree setup")
#undef create_proc_plimit
sysctl_createv(clog, 0, NULL, NULL,
sysctl_createv(&proc_sysctllog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE|CTLFLAG_ANYWRITE,
CTLTYPE_INT, "stopfork",
SYSCTL_DESCR("Stop process at fork(2)"),
sysctl_proc_stop, 0, NULL, 0,
CTL_PROC, PROC_CURPROC, PROC_PID_STOPFORK, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
sysctl_createv(&proc_sysctllog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE|CTLFLAG_ANYWRITE,
CTLTYPE_INT, "stopexec",
SYSCTL_DESCR("Stop process at execve(2)"),
sysctl_proc_stop, 0, NULL, 0,
CTL_PROC, PROC_CURPROC, PROC_PID_STOPEXEC, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
sysctl_createv(&proc_sysctllog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE|CTLFLAG_ANYWRITE,
CTLTYPE_INT, "stopexit",
SYSCTL_DESCR("Stop process before completing exit"),

View File

@ -1,4 +1,4 @@
/* $NetBSD: tty.c,v 1.234 2009/10/11 17:20:48 dsl Exp $ */
/* $NetBSD: tty.c,v 1.235 2010/05/26 23:53:21 pooka Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -63,7 +63,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.234 2009/10/11 17:20:48 dsl Exp $");
__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.235 2010/05/26 23:53:21 pooka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -208,15 +208,18 @@ uint64_t tk_rawcc;
static kauth_listener_t tty_listener;
SYSCTL_SETUP(sysctl_kern_tkstat_setup, "sysctl kern.tkstat subtree setup")
static struct sysctllog *kern_tkstat_sysctllog;
static void
sysctl_kern_tkstat_setup(void)
{
sysctl_createv(clog, 0, NULL, NULL,
sysctl_createv(&kern_tkstat_sysctllog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "kern", NULL,
NULL, 0, NULL, 0,
CTL_KERN, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
sysctl_createv(&kern_tkstat_sysctllog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "tkstat",
SYSCTL_DESCR("Number of characters sent and and "
@ -224,25 +227,25 @@ SYSCTL_SETUP(sysctl_kern_tkstat_setup, "sysctl kern.tkstat subtree setup")
NULL, 0, NULL, 0,
CTL_KERN, KERN_TKSTAT, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
sysctl_createv(&kern_tkstat_sysctllog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_QUAD, "nin",
SYSCTL_DESCR("Total number of tty input characters"),
NULL, 0, &tk_nin, 0,
CTL_KERN, KERN_TKSTAT, KERN_TKSTAT_NIN, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
sysctl_createv(&kern_tkstat_sysctllog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_QUAD, "nout",
SYSCTL_DESCR("Total number of tty output characters"),
NULL, 0, &tk_nout, 0,
CTL_KERN, KERN_TKSTAT, KERN_TKSTAT_NOUT, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
sysctl_createv(&kern_tkstat_sysctllog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_QUAD, "cancc",
SYSCTL_DESCR("Number of canonical tty input characters"),
NULL, 0, &tk_cancc, 0,
CTL_KERN, KERN_TKSTAT, KERN_TKSTAT_CANCC, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
sysctl_createv(&kern_tkstat_sysctllog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_QUAD, "rawcc",
SYSCTL_DESCR("Number of raw tty input characters"),
@ -2766,6 +2769,8 @@ tty_init(void)
tty_listener = kauth_listen_scope(KAUTH_SCOPE_DEVICE,
tty_listener_cb, NULL);
sysctl_kern_tkstat_setup();
}
/*