Replace a large number of link set based sysctl node creations with

calls from subsystem constructors.  Benefits both future kernel
modules and rump.

no change to sysctl nodes on i386/MONOLITHIC & build tested i386/ALL
This commit is contained in:
pooka 2009-09-16 15:23:04 +00:00
parent 4b1eb92699
commit 11281f01a0
29 changed files with 213 additions and 120 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: init_main.c,v 1.399 2009/09/13 18:45:10 pooka Exp $ */
/* $NetBSD: init_main.c,v 1.400 2009/09/16 15:23:04 pooka Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@ -97,7 +97,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.399 2009/09/13 18:45:10 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.400 2009/09/16 15:23:04 pooka Exp $");
#include "opt_ddb.h"
#include "opt_ipsec.h"
@ -589,6 +589,8 @@ main(void)
*/
config_finalize();
sysctl_finalize();
/*
* Now that autoconfiguration has completed, we can determine
* the root and dump devices.

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_sysctl.c,v 1.225 2009/08/24 20:53:00 dyoung Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.226 2009/09/16 15:23:04 pooka Exp $ */
/*-
* Copyright (c) 2003, 2007, 2008 The NetBSD Foundation, Inc.
@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.225 2009/08/24 20:53:00 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.226 2009/09/16 15:23:04 pooka Exp $");
#include "opt_defcorename.h"
#include "ksyms.h"
@ -235,14 +235,20 @@ sysctl_init(void)
f = (void*)*sysctl_setup;
(*f)(NULL);
}
}
/*
* Setting this means no more permanent nodes can be added,
* trees that claim to be readonly at the root now are, and if
* the main tree is readonly, *everything* is.
*
* Call this at the end of kernel init.
*/
void
sysctl_finalize(void)
{
/*
* setting this means no more permanent nodes can be added,
* trees that claim to be readonly at the root now are, and if
* the main tree is readonly, *everything* is.
*/
sysctl_root.sysctl_flags |= CTLFLAG_PERMANENT;
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr_autoconf.c,v 1.181 2009/09/06 16:18:56 pooka Exp $ */
/* $NetBSD: subr_autoconf.c,v 1.182 2009/09/16 15:23:04 pooka Exp $ */
/*
* Copyright (c) 1996, 2000 Christopher G. Demetriou
@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.181 2009/09/06 16:18:56 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.182 2009/09/16 15:23:04 pooka Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
@ -225,6 +225,8 @@ static int config_initialized; /* config_init() has been called. */
static int config_do_twiddle;
static callout_t config_twiddle_ch;
static void sysctl_detach_setup(struct sysctllog **);
/*
* Initialize the autoconfiguration data structures. Normally this
* is done by configure(), but some platforms need to do this very
@ -267,6 +269,7 @@ config_init(void)
initcftable.ct_cfdata = cfdata;
TAILQ_INSERT_TAIL(&allcftables, &initcftable, ct_list);
sysctl_detach_setup(NULL);
config_initialized = 1;
}
@ -2578,7 +2581,8 @@ deviter_release(deviter_t *di)
mutex_exit(&alldevs_mtx);
}
SYSCTL_SETUP(sysctl_detach_setup, "sysctl detach setup")
static void
sysctl_detach_setup(struct sysctllog **clog)
{
const struct sysctlnode *node = NULL;

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr_bufq.c,v 1.18 2009/01/19 14:54:28 yamt Exp $ */
/* $NetBSD: subr_bufq.c,v 1.19 2009/09/16 15:23:04 pooka Exp $ */
/* NetBSD: subr_disk.c,v 1.70 2005/08/20 12:00:01 yamt Exp $ */
/*-
@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: subr_bufq.c,v 1.18 2009/01/19 14:54:28 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: subr_bufq.c,v 1.19 2009/09/16 15:23:04 pooka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -76,12 +76,24 @@ __KERNEL_RCSID(0, "$NetBSD: subr_bufq.c,v 1.18 2009/01/19 14:54:28 yamt Exp $");
#include <sys/bufq.h>
#include <sys/bufq_impl.h>
#include <sys/kmem.h>
#include <sys/once.h>
#include <sys/sysctl.h>
BUFQ_DEFINE(dummy, 0, NULL); /* so that bufq_strats won't be empty */
#define STRAT_MATCH(id, bs) (strcmp((id), (bs)->bs_name) == 0)
static int bufq_init(void);
static void sysctl_kern_bufq_strategies_setup(struct sysctllog **);
static int
bufq_init(void)
{
sysctl_kern_bufq_strategies_setup(NULL);
return 0;
}
/*
* Create a device buffer queue.
*/
@ -92,8 +104,11 @@ bufq_alloc(struct bufq_state **bufqp, const char *strategy, int flags)
const struct bufq_strat *bsp;
const struct bufq_strat * const *it;
struct bufq_state *bufq;
static ONCE_DECL(bufq_init_ctrl);
int error = 0;
RUN_ONCE(&bufq_init_ctrl, bufq_init);
KASSERT((flags & BUFQ_EXACT) == 0 || strategy != BUFQ_STRAT_ANY);
switch (flags & BUFQ_SORT_MASK) {
@ -309,7 +324,8 @@ out:
return error;
}
SYSCTL_SETUP(sysctl_kern_bufq_strategies_setup, "sysctl kern.bufq tree setup")
static void
sysctl_kern_bufq_strategies_setup(struct sysctllog **clog)
{
const struct sysctlnode *node;

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr_iostat.c,v 1.17 2009/04/04 07:30:10 ad Exp $ */
/* $NetBSD: subr_iostat.c,v 1.18 2009/09/16 15:23:04 pooka Exp $ */
/* NetBSD: subr_disk.c,v 1.69 2005/05/29 22:24:15 christos Exp */
/*-
@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: subr_iostat.c,v 1.17 2009/04/04 07:30:10 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: subr_iostat.c,v 1.18 2009/09/16 15:23:04 pooka Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -96,6 +96,8 @@ struct iostatlist_head iostatlist = TAILQ_HEAD_INITIALIZER(iostatlist);
int iostat_count; /* number of drives in global drivelist */
krwlock_t iostatlist_lock;
static void sysctl_io_stats_setup(struct sysctllog **);
/*
* Initialise the iostat subsystem.
*/
@ -104,6 +106,7 @@ iostat_init(void)
{
rw_init(&iostatlist_lock);
sysctl_io_stats_setup(NULL);
}
/*
@ -376,7 +379,8 @@ sysctl_hw_iostats(SYSCTLFN_ARGS)
return (error);
}
SYSCTL_SETUP(sysctl_io_stats_setup, "sysctl i/o stats setup")
static void
sysctl_io_stats_setup(struct sysctllog **clog)
{
sysctl_createv(clog, 0, NULL, NULL,

View File

@ -1,4 +1,4 @@
/* $NetBSD: uipc_accf.c,v 1.8 2008/11/20 10:00:54 ad Exp $ */
/* $NetBSD: uipc_accf.c,v 1.9 2009/09/16 15:23:04 pooka Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uipc_accf.c,v 1.8 2008/11/20 10:00:54 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: uipc_accf.c,v 1.9 2009/09/16 15:23:04 pooka Exp $");
#define ACCEPT_FILTER_MOD
@ -87,7 +87,8 @@ static LIST_HEAD(, accept_filter) accept_filtlsthd =
/*
* Names of Accept filter sysctl objects
*/
SYSCTL_SETUP(sysctl_net_inet_accf_setup, "sysctl net.inet.accf subtree setup")
static void
sysctl_net_inet_accf_setup(struct sysctllog **clog)
{
sysctl_createv(clog, 0, NULL, NULL,
@ -184,6 +185,7 @@ accept_filter_init0(void)
{
rw_init(&accept_filter_lock);
sysctl_net_inet_accf_setup(NULL);
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: sync_subr.c,v 1.40 2009/03/15 17:22:38 cegger Exp $ */
/* $NetBSD: sync_subr.c,v 1.41 2009/09/16 15:23:04 pooka Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sync_subr.c,v 1.40 2009/03/15 17:22:38 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: sync_subr.c,v 1.41 2009/09/16 15:23:04 pooka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -102,6 +102,8 @@ static long syncer_last;
static struct synclist *syncer_workitem_pending;
struct lwp *updateproc = NULL;
static void sysctl_vfs_syncfs_setup(struct sysctllog **);
void
vn_initialize_syncerd(void)
{
@ -109,6 +111,8 @@ vn_initialize_syncerd(void)
syncer_last = SYNCER_MAXDELAY + 2;
sysctl_vfs_syncfs_setup(NULL);
syncer_workitem_pending =
kmem_alloc(syncer_last * sizeof (struct synclist), KM_SLEEP);
@ -344,7 +348,8 @@ speedup_syncer(void)
return (1);
}
SYSCTL_SETUP(sysctl_vfs_syncfs_setup, "sysctl vfs.sync subtree setup")
static void
sysctl_vfs_syncfs_setup(struct sysctllog **clog)
{
const struct sysctlnode *rnode, *cnode;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if.c,v 1.236 2009/09/15 23:24:34 jakllsch Exp $ */
/* $NetBSD: if.c,v 1.237 2009/09/16 15:23:04 pooka Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@ -90,7 +90,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.236 2009/09/15 23:24:34 jakllsch Exp $");
__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.237 2009/09/16 15:23:04 pooka Exp $");
#include "opt_inet.h"
@ -170,6 +170,9 @@ static void if_detach_queues(struct ifnet *, struct ifqueue *);
static void sysctl_sndq_setup(struct sysctllog **, const char *,
struct ifaltq *);
static void sysctl_net_ifq_setup(struct sysctllog **, int, const char *,
int, const char *, int, struct ifqueue *);
/*
* Network interface utility routines.
*
@ -179,6 +182,16 @@ static void sysctl_sndq_setup(struct sysctllog **, const char *,
void
ifinit(void)
{
#ifdef INET
{extern struct ifqueue ipintrq;
sysctl_net_ifq_setup(NULL, PF_INET, "inet", IPPROTO_IP, "ip",
IPCTL_IFQ, &ipintrq);}
#endif /* INET */
#ifdef INET6
{extern struct ifqueue ip6intrq;
sysctl_net_ifq_setup(NULL, PF_INET6, "inet6", IPPROTO_IPV6, "ip6",
IPV6CTL_IFQ, &ip6intrq);}
#endif /* INET6 */
mutex_init(&index_gen_mtx, MUTEX_DEFAULT, IPL_NONE);
callout_init(&if_slowtimo_ch, 0);
@ -2076,26 +2089,4 @@ sysctl_net_ifq_setup(struct sysctllog **clog,
NULL, 0, &ifq->ifq_drops, 0,
CTL_NET, pf, ipn, qid, IFQCTL_DROPS, CTL_EOL);
}
#ifdef INET
SYSCTL_SETUP(sysctl_net_inet_ip_ifq_setup,
"sysctl net.inet.ip.ifq subtree setup")
{
extern struct ifqueue ipintrq;
sysctl_net_ifq_setup(clog, PF_INET, "inet", IPPROTO_IP, "ip",
IPCTL_IFQ, &ipintrq);
}
#endif /* INET */
#ifdef INET6
SYSCTL_SETUP(sysctl_net_inet6_ip6_ifq_setup,
"sysctl net.inet6.ip6.ifq subtree setup")
{
extern struct ifqueue ip6intrq;
sysctl_net_ifq_setup(clog, PF_INET6, "inet6", IPPROTO_IPV6, "ip6",
IPV6CTL_IFQ, &ip6intrq);
}
#endif /* INET6 */
#endif /* INET || INET6 */

View File

@ -1,4 +1,4 @@
/* $NetBSD: route.c,v 1.117 2009/04/02 21:02:06 christos Exp $ */
/* $NetBSD: route.c,v 1.118 2009/09/16 15:23:04 pooka Exp $ */
/*-
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@ -93,7 +93,7 @@
#include "opt_route.h"
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.117 2009/04/02 21:02:06 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.118 2009/09/16 15:23:04 pooka Exp $");
#include <sys/param.h>
#include <sys/sysctl.h>
@ -143,7 +143,9 @@ static int rtflushclone1(struct rtentry *, void *);
static void rtflushclone(sa_family_t family, struct rtentry *);
#ifdef RTFLUSH_DEBUG
SYSCTL_SETUP(sysctl_net_rtcache_setup, "sysctl net.rtcache.debug setup")
static void sysctl_net_rtcache_setup(struct sysctllog **);
static void
sysctl_net_rtcache_setup(struct sysctllog **clog)
{
const struct sysctlnode *rnode;
@ -262,6 +264,10 @@ void
route_init(void)
{
#ifdef RTFLUSH_DEBUG
sysctl_net_rtcache_setup(NULL);
#endif
pool_init(&rtentry_pool, sizeof(struct rtentry), 0, 0, 0, "rtentpl",
NULL, IPL_SOFTNET);
pool_init(&rttimer_pool, sizeof(struct rttimer), 0, 0, 0, "rttmrpl",

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtsock.c,v 1.126 2009/09/12 18:09:25 tsutsui Exp $ */
/* $NetBSD: rtsock.c,v 1.127 2009/09/16 15:23:04 pooka Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.126 2009/09/12 18:09:25 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.127 2009/09/16 15:23:04 pooka Exp $");
#include "opt_inet.h"
#ifdef _KERNEL_OPT
@ -106,6 +106,7 @@ static int rt_msg2(int, struct rt_addrinfo *, void *, struct rt_walkarg *, int *
static int rt_xaddrs(u_char, const char *, const char *, struct rt_addrinfo *);
static struct mbuf *rt_makeifannouncemsg(struct ifnet *, int, int,
struct rt_addrinfo *);
static void sysctl_net_route_setup(struct sysctllog **);
static int sysctl_dumpentry(struct rtentry *, void *);
static int sysctl_iflist(int, struct rt_walkarg *, int);
static int sysctl_rtable(SYSCTLFN_PROTO);
@ -1218,6 +1219,7 @@ void
rt_init(void)
{
sysctl_net_route_setup(NULL);
route_intrq.ifq_maxlen = route_maxqlen;
route_sih = softint_establish(SOFTINT_NET | SOFTINT_MPSAFE,
route_intr, NULL);
@ -1250,7 +1252,8 @@ struct domain routedomain = {
.dom_protoswNPROTOSW = &routesw[__arraycount(routesw)],
};
SYSCTL_SETUP(sysctl_net_route_setup, "sysctl net.route subtree setup")
static void
sysctl_net_route_setup(struct sysctllog **clog)
{
const struct sysctlnode *rnode = NULL;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_arp.c,v 1.146 2009/08/12 22:16:15 dyoung Exp $ */
/* $NetBSD: if_arp.c,v 1.147 2009/09/16 15:23:04 pooka Exp $ */
/*-
* Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.146 2009/08/12 22:16:15 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.147 2009/09/16 15:23:04 pooka Exp $");
#include "opt_ddb.h"
#include "opt_inet.h"
@ -318,10 +318,13 @@ do { \
#define ARP_UNLOCK() arp_unlock()
static void sysctl_net_inet_arp_setup(struct sysctllog **);
void
arp_init(void)
{
sysctl_net_inet_arp_setup(NULL);
arpstat_percpu = percpu_alloc(sizeof(uint64_t) * ARP_NSTATS);
}
@ -1594,7 +1597,8 @@ sysctl_net_inet_arp_stats(SYSCTLFN_ARGS)
return NETSTAT_SYSCTL(arpstat_percpu, ARP_NSTATS);
}
SYSCTL_SETUP(sysctl_net_inet_arp_setup, "sysctl net.inet.arp subtree setup")
static void
sysctl_net_inet_arp_setup(struct sysctllog **clog)
{
const struct sysctlnode *node;

View File

@ -1,4 +1,4 @@
/* $NetBSD: igmp.c,v 1.50 2009/09/13 18:45:11 pooka Exp $ */
/* $NetBSD: igmp.c,v 1.51 2009/09/16 15:23:04 pooka Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: igmp.c,v 1.50 2009/09/13 18:45:11 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: igmp.c,v 1.51 2009/09/16 15:23:04 pooka Exp $");
#include "opt_mrouting.h"
@ -82,6 +82,8 @@ static int rti_fill(struct in_multi *);
static struct router_info *rti_find(struct ifnet *);
static void rti_delete(struct ifnet *);
static void sysctl_net_inet_igmp_setup(struct sysctllog **);
static int
rti_fill(struct in_multi *inm)
{
@ -149,6 +151,7 @@ void
igmp_init(void)
{
sysctl_net_inet_igmp_setup(NULL);
pool_init(&igmp_rti_pool, sizeof(struct router_info), 0, 0, 0,
"igmppl", NULL, IPL_SOFTNET);
igmpstat_percpu = percpu_alloc(sizeof(uint64_t) * IGMP_NSTATS);
@ -608,7 +611,8 @@ sysctl_net_inet_igmp_stats(SYSCTLFN_ARGS)
return (NETSTAT_SYSCTL(igmpstat_percpu, IGMP_NSTATS));
}
SYSCTL_SETUP(sysctl_net_inet_igmp_setup, "sysctl net.inet.igmp subtree setup")
static void
sysctl_net_inet_igmp_setup(struct sysctllog **clog)
{
sysctl_createv(clog, 0, NULL, NULL,

View File

@ -1,4 +1,4 @@
/* $NetBSD: in_proto.c,v 1.98 2009/09/14 10:36:50 degroote Exp $ */
/* $NetBSD: in_proto.c,v 1.99 2009/09/16 15:23:05 pooka Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: in_proto.c,v 1.98 2009/09/14 10:36:50 degroote Exp $");
__KERNEL_RCSID(0, "$NetBSD: in_proto.c,v 1.99 2009/09/16 15:23:05 pooka Exp $");
#include "opt_mrouting.h"
#include "opt_eon.h" /* ISO CLNL over IP */
@ -362,6 +362,7 @@ const struct protosw inetsw[] = {
.pr_output = rip_output,
.pr_ctloutput = rip_ctloutput,
.pr_usrreq = rip_usrreq,
.pr_init = carp_init,
},
#endif /* NCARP > 0 */
#if NPFSYNC > 0

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_carp.c,v 1.38 2009/06/07 06:11:18 taca Exp $ */
/* $NetBSD: ip_carp.c,v 1.39 2009/09/16 15:23:05 pooka Exp $ */
/* $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $ */
/*
@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.38 2009/06/07 06:11:18 taca Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.39 2009/09/16 15:23:05 pooka Exp $");
/*
* TODO:
@ -219,6 +219,8 @@ int carp_ether_addmulti(struct carp_softc *, struct ifreq *);
int carp_ether_delmulti(struct carp_softc *, struct ifreq *);
void carp_ether_purgemulti(struct carp_softc *);
static void sysctl_net_inet_carp_setup(struct sysctllog **);
struct if_clone carp_cloner =
IF_CLONE_INITIALIZER("carp", carp_clone_create, carp_clone_destroy);
@ -2252,7 +2254,15 @@ sysctl_net_inet_carp_stats(SYSCTLFN_ARGS)
return (NETSTAT_SYSCTL(carpstat_percpu, CARP_NSTATS));
}
SYSCTL_SETUP(sysctl_net_inet_carp_setup, "sysctl net.inet.carp subtree setup")
void
carp_init(void)
{
sysctl_net_inet_carp_setup(NULL);
}
static void
sysctl_net_inet_carp_setup(struct sysctllog **clog)
{
sysctl_createv(clog, 0, NULL, NULL,

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_carp.h,v 1.5 2008/04/16 20:58:35 dyoung Exp $ */
/* $NetBSD: ip_carp.h,v 1.6 2009/09/16 15:23:05 pooka Exp $ */
/* $OpenBSD: ip_carp.h,v 1.18 2005/04/20 23:00:41 mpf Exp $ */
/*
@ -152,6 +152,7 @@ struct carpreq {
}
#ifdef _KERNEL
void carp_init(void);
void carp_ifdetach (struct ifnet *);
void carp_proto_input (struct mbuf *, ...);
void carp_carpdev_state(void *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_icmp.c,v 1.120 2008/06/18 09:06:28 yamt Exp $ */
/* $NetBSD: ip_icmp.c,v 1.121 2009/09/16 15:23:05 pooka Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -94,7 +94,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.120 2008/06/18 09:06:28 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.121 2009/09/16 15:23:05 pooka Exp $");
#include "opt_ipsec.h"
@ -178,10 +178,14 @@ static void icmp_redirect_timeout(struct rtentry *, struct rttimer *);
static int icmp_ratelimit(const struct in_addr *, const int, const int);
static void sysctl_netinet_icmp_setup(struct sysctllog **);
void
icmp_init(void)
{
sysctl_netinet_icmp_setup(NULL);
/*
* This is only useful if the user initializes redirtimeout to
* something other than zero.
@ -983,7 +987,8 @@ sysctl_net_inet_icmp_stats(SYSCTLFN_ARGS)
return (NETSTAT_SYSCTL(icmpstat_percpu, ICMP_NSTATS));
}
SYSCTL_SETUP(sysctl_net_inet_icmp_setup, "sysctl net.inet.icmp subtree setup")
static void
sysctl_netinet_icmp_setup(struct sysctllog **clog)
{
sysctl_createv(clog, 0, NULL, NULL,

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_input.c,v 1.283 2009/07/17 18:09:25 minskim Exp $ */
/* $NetBSD: ip_input.c,v 1.284 2009/09/16 15:23:05 pooka Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.283 2009/07/17 18:09:25 minskim Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.284 2009/09/16 15:23:05 pooka Exp $");
#include "opt_inet.h"
#include "opt_compat_netbsd.h"
@ -383,6 +383,8 @@ struct mowner ip_rx_mowner = MOWNER_INIT("internet", "rx");
struct mowner ip_tx_mowner = MOWNER_INIT("internet", "tx");
#endif
static void sysctl_net_inet_ip_setup(struct sysctllog **);
/*
* Compute IP limits derived from the value of nmbclusters.
*/
@ -403,6 +405,8 @@ ip_init(void)
const struct protosw *pr;
int i;
sysctl_net_inet_ip_setup(NULL);
pool_init(&inmulti_pool, sizeof(struct in_multi), 0, 0, 0, "inmltpl",
NULL, IPL_SOFTNET);
pool_init(&ipqent_pool, sizeof(struct ipqent), 0, 0, 0, "ipqepl",
@ -2248,7 +2252,8 @@ sysctl_net_inet_ip_stats(SYSCTLFN_ARGS)
return (NETSTAT_SYSCTL(ipstat_percpu, IP_NSTATS));
}
SYSCTL_SETUP(sysctl_net_inet_ip_setup, "sysctl net.inet.ip subtree setup")
static void
sysctl_net_inet_ip_setup(struct sysctllog **clog)
{
extern int subnetsarelocal, hostzeroisbroadcast;

View File

@ -1,4 +1,4 @@
/* $NetBSD: raw_ip.c,v 1.109 2009/01/19 02:27:57 christos Exp $ */
/* $NetBSD: raw_ip.c,v 1.110 2009/09/16 15:23:05 pooka Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.109 2009/01/19 02:27:57 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.110 2009/09/16 15:23:05 pooka Exp $");
#include "opt_inet.h"
#include "opt_compat_netbsd.h"
@ -119,6 +119,8 @@ int rip_bind(struct inpcb *, struct mbuf *);
int rip_connect(struct inpcb *, struct mbuf *);
void rip_disconnect(struct inpcb *);
static void sysctl_net_inet_raw_setup(struct sysctllog **);
/*
* Nominal space allocated to a raw ip socket.
*/
@ -136,6 +138,7 @@ void
rip_init(void)
{
sysctl_net_inet_raw_setup(NULL);
in_pcbinit(&rawcbtable, 1, 1);
}
@ -696,7 +699,8 @@ release:
return (error);
}
SYSCTL_SETUP(sysctl_net_inet_raw_setup, "sysctl net.inet.raw subtree setup")
static void
sysctl_net_inet_raw_setup(struct sysctllog **clog)
{
sysctl_createv(clog, 0, NULL, NULL,

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_subr.c,v 1.237 2009/05/27 17:41:03 pooka Exp $ */
/* $NetBSD: tcp_subr.c,v 1.238 2009/09/16 15:23:05 pooka Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.237 2009/05/27 17:41:03 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.238 2009/09/16 15:23:05 pooka Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -395,6 +395,8 @@ tcp_init(void)
icmp6_mtudisc_callback_register(tcp6_mtudisc_callback);
#endif
tcp_usrreq_init();
/* Initialize timer state. */
tcp_timer_init();

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_usrreq.c,v 1.156 2009/09/09 22:41:28 darran Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.157 2009/09/16 15:23:05 pooka Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -95,7 +95,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.156 2009/09/09 22:41:28 darran Exp $");
__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.157 2009/09/16 15:23:05 pooka Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -2030,21 +2030,14 @@ sysctl_net_inet_tcp_setup2(struct sysctllog **clog, int pf, const char *pfname,
NULL, 0, &tcp_abc_aggressive, 0, CTL_CREATE, CTL_EOL);
}
/*
* Sysctl for tcp variables.
*/
void
tcp_usrreq_init(void)
{
#ifdef INET
SYSCTL_SETUP(sysctl_net_inet_tcp_setup, "sysctl net.inet.tcp subtree setup")
{
sysctl_net_inet_tcp_setup2(clog, PF_INET, "inet", "tcp");
}
#endif /* INET */
sysctl_net_inet_tcp_setup2(NULL, PF_INET, "inet", "tcp");
#endif
#ifdef INET6
SYSCTL_SETUP(sysctl_net_inet6_tcp6_setup, "sysctl net.inet6.tcp6 subtree setup")
{
sysctl_net_inet_tcp_setup2(clog, PF_INET6, "inet6", "tcp6");
sysctl_net_inet_tcp_setup2(NULL, PF_INET6, "inet6", "tcp6");
#endif
}
#endif /* INET6 */

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_var.h,v 1.161 2009/09/09 22:41:28 darran Exp $ */
/* $NetBSD: tcp_var.h,v 1.162 2009/09/16 15:23:05 pooka Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -881,6 +881,7 @@ struct mbuf *
void tcp_trace(short, short, struct tcpcb *, struct mbuf *, int);
struct tcpcb *
tcp_usrclosed(struct tcpcb *);
void tcp_usrreq_init(void);
int tcp_usrreq(struct socket *,
int, struct mbuf *, struct mbuf *, struct mbuf *, struct lwp *);
void tcp_xmit_timer(struct tcpcb *, uint32_t);

View File

@ -1,4 +1,4 @@
/* $NetBSD: udp_usrreq.c,v 1.178 2009/07/19 23:17:33 minskim Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.179 2009/09/16 15:23:05 pooka Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.178 2009/07/19 23:17:33 minskim Exp $");
__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.179 2009/09/16 15:23:05 pooka Exp $");
#include "opt_inet.h"
#include "opt_compat_netbsd.h"
@ -232,10 +232,14 @@ EVCNT_ATTACH_STATIC(udp6_swcsum);
#endif /* UDP_CSUM_COUNTERS */
static void sysctl_net_inet_udp_setup(struct sysctllog **);
void
udp_init(void)
{
sysctl_net_inet_udp_setup(NULL);
in_pcbinit(&udbtable, udbhashsize, udbhashsize);
MOWNER_ATTACH(&udp_tx_mowner);
@ -1367,7 +1371,8 @@ sysctl_net_inet_udp_stats(SYSCTLFN_ARGS)
/*
* Sysctl for udp variables.
*/
SYSCTL_SETUP(sysctl_net_inet_udp_setup, "sysctl net.inet.udp subtree setup")
static void
sysctl_net_inet_udp_setup(struct sysctllog **clog)
{
sysctl_createv(clog, 0, NULL, NULL,

View File

@ -1,4 +1,4 @@
/* $NetBSD: icmp6.c,v 1.152 2009/03/18 16:00:22 cegger Exp $ */
/* $NetBSD: icmp6.c,v 1.153 2009/09/16 15:23:05 pooka Exp $ */
/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
/*
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.152 2009/03/18 16:00:22 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.153 2009/09/16 15:23:05 pooka Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -170,11 +170,14 @@ static int icmp6_notify_error(struct mbuf *, int, int, int);
static struct rtentry *icmp6_mtudisc_clone(struct sockaddr *);
static void icmp6_mtudisc_timeout(struct rtentry *, struct rttimer *);
static void icmp6_redirect_timeout(struct rtentry *, struct rttimer *);
static void sysctl_net_inet6_icmp6_setup(struct sysctllog **);
void
icmp6_init(void)
{
sysctl_net_inet6_icmp6_setup(NULL);
mld_init();
icmp6_mtudisc_timeout_q = rt_timer_queue_create(pmtu_expire);
icmp6_redirect_timeout_q = rt_timer_queue_create(icmp6_redirtimeout);
@ -2756,8 +2759,8 @@ sysctl_net_inet6_icmp6_stats(SYSCTLFN_ARGS)
return (NETSTAT_SYSCTL(icmp6stat_percpu, ICMP6_NSTATS));
}
SYSCTL_SETUP(sysctl_net_inet6_icmp6_setup,
"sysctl net.inet6.icmp6 subtree setup")
static void
sysctl_net_inet6_icmp6_setup(struct sysctllog **clog)
{
extern int nd6_maxqueuelen; /* defined in nd6.c */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip6_input.c,v 1.127 2009/05/01 03:23:39 martin Exp $ */
/* $NetBSD: ip6_input.c,v 1.128 2009/09/16 15:23:05 pooka Exp $ */
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
/*
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.127 2009/05/01 03:23:39 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.128 2009/09/16 15:23:05 pooka Exp $");
#include "opt_inet.h"
#include "opt_inet6.h"
@ -161,6 +161,7 @@ static struct m_tag *ip6_setdstifaddr(struct mbuf *, const struct in6_ifaddr *);
static int ip6_hopopts_input(u_int32_t *, u_int32_t *, struct mbuf **, int *);
static struct mbuf *ip6_pullexthdr(struct mbuf *, size_t, int);
static void sysctl_net_inet6_ip6_setup(struct sysctllog **);
/*
* IP6 initialization: fill in IP6 protocol switch table.
@ -172,6 +173,7 @@ ip6_init(void)
const struct ip6protosw *pr;
int i;
sysctl_net_inet6_ip6_setup(NULL);
pr = (const struct ip6protosw *)pffindproto(PF_INET6, IPPROTO_RAW, SOCK_RAW);
if (pr == 0)
panic("ip6_init");
@ -1683,7 +1685,8 @@ sysctl_net_inet6_ip6_stats(SYSCTLFN_ARGS)
return (NETSTAT_SYSCTL(ip6stat_percpu, IP6_NSTATS));
}
SYSCTL_SETUP(sysctl_net_inet6_ip6_setup, "sysctl net.inet6.ip6 subtree setup")
static void
sysctl_net_inet6_ip6_setup(struct sysctllog **clog)
{
#ifdef RFC2292
#define IS2292(x, y) ((in6p->in6p_flags & IN6P_RFC2292) ? (x) : (y))

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip6_mroute.c,v 1.97 2009/03/18 16:00:23 cegger Exp $ */
/* $NetBSD: ip6_mroute.c,v 1.98 2009/09/16 15:23:05 pooka Exp $ */
/* $KAME: ip6_mroute.c,v 1.49 2001/07/25 09:21:18 jinmei Exp $ */
/*
@ -117,7 +117,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.97 2009/03/18 16:00:23 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.98 2009/09/16 15:23:05 pooka Exp $");
#include "opt_inet.h"
#include "opt_mrouting.h"
@ -293,6 +293,7 @@ static int add_m6if(struct mif6ctl *);
static int del_m6if(mifi_t *);
static int add_m6fc(struct mf6cctl *);
static int del_m6fc(struct mf6cctl *);
static void sysctl_net_inet6_pim6_setup(struct sysctllog **);
static callout_t expire_upcalls_ch;
@ -300,6 +301,7 @@ void
pim6_init(void)
{
sysctl_net_inet6_pim6_setup(NULL);
pim6stat_percpu = percpu_alloc(sizeof(uint64_t) * PIM6_NSTATS);
}
@ -1934,7 +1936,8 @@ sysctl_net_inet6_pim6_stats(SYSCTLFN_ARGS)
return (NETSTAT_SYSCTL(pim6stat_percpu, PIM6_NSTATS));
}
SYSCTL_SETUP(sysctl_net_inet6_pim6_setup, "sysctl net.inet6.pim6 subtree setup")
static void
sysctl_net_inet6_pim6_setup(struct sysctllog **clog)
{
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,

View File

@ -1,4 +1,4 @@
/* $NetBSD: raw_ip6.c,v 1.104 2009/05/06 21:41:59 elad Exp $ */
/* $NetBSD: raw_ip6.c,v 1.105 2009/09/16 15:23:05 pooka Exp $ */
/* $KAME: raw_ip6.c,v 1.82 2001/07/23 18:57:56 jinmei Exp $ */
/*
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.104 2009/05/06 21:41:59 elad Exp $");
__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.105 2009/09/16 15:23:05 pooka Exp $");
#include "opt_ipsec.h"
@ -126,6 +126,8 @@ static percpu_t *rip6stat_percpu;
#define RIP6_STATINC(x) _NET_STATINC(rip6stat_percpu, x)
static void sysctl_net_inet6_raw6_setup(struct sysctllog **);
/*
* Initialize raw connection block queue.
*/
@ -133,6 +135,7 @@ void
rip6_init(void)
{
sysctl_net_inet6_raw6_setup(NULL);
in6_pcbinit(&raw6cbtable, 1, 1);
rip6stat_percpu = percpu_alloc(sizeof(uint64_t) * RIP6_NSTATS);
@ -870,7 +873,8 @@ sysctl_net_inet6_raw6_stats(SYSCTLFN_ARGS)
return (NETSTAT_SYSCTL(rip6stat_percpu, RIP6_NSTATS));
}
SYSCTL_SETUP(sysctl_net_inet6_raw6_setup, "sysctl net.inet6.raw6 subtree setup")
static void
sysctl_net_inet6_raw6_setup(struct sysctllog **clog)
{
sysctl_createv(clog, 0, NULL, NULL,

View File

@ -1,4 +1,4 @@
/* $NetBSD: udp6_usrreq.c,v 1.87 2009/03/18 16:00:23 cegger Exp $ */
/* $NetBSD: udp6_usrreq.c,v 1.88 2009/09/16 15:23:05 pooka Exp $ */
/* $KAME: udp6_usrreq.c,v 1.86 2001/05/27 17:33:00 itojun Exp $ */
/*
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: udp6_usrreq.c,v 1.87 2009/03/18 16:00:23 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: udp6_usrreq.c,v 1.88 2009/09/16 15:23:05 pooka Exp $");
#include <sys/param.h>
#include <sys/malloc.h>
@ -113,11 +113,13 @@ extern struct inpcbtable udbtable;
percpu_t *udp6stat_percpu;
static void udp6_notify(struct in6pcb *, int);
static void sysctl_net_inet6_udp6_setup(struct sysctllog **);
void
udp6_init(void)
{
/* initialization done in udp_init() due to initialization order */
sysctl_net_inet6_udp6_setup(NULL);
}
/*
@ -414,7 +416,8 @@ sysctl_net_inet6_udp6_stats(SYSCTLFN_ARGS)
return (NETSTAT_SYSCTL(udp6stat_percpu, UDP6_NSTATS));
}
SYSCTL_SETUP(sysctl_net_inet6_udp6_setup, "sysctl net.inet6.udp6 subtree setup")
static void
sysctl_net_inet6_udp6_setup(struct sysctllog **clog)
{
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump.c,v 1.114 2009/09/13 19:09:13 pooka Exp $ */
/* $NetBSD: rump.c,v 1.115 2009/09/16 15:23:05 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.114 2009/09/13 19:09:13 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.115 2009/09/16 15:23:05 pooka Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@ -246,13 +246,13 @@ rump__init(int rump_version)
callout_startup();
callout_init_cpu(&rump_cpu);
sysctl_init();
kqueue_init();
iostat_init();
uid_init();
percpu_init();
fd_sys_init();
module_init();
sysctl_init();
softint_init(&rump_cpu);
devsw_init();
secmodel_start();
@ -270,6 +270,8 @@ rump__init(int rump_version)
panic("aiodoned");
}
sysctl_finalize();
rumpuser_gethostname(hostname, MAXHOSTNAMELEN, &error);
hostnamelen = strlen(hostname);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysctl.h,v 1.186 2009/08/21 22:51:00 dyoung Exp $ */
/* $NetBSD: sysctl.h,v 1.187 2009/09/16 15:23:05 pooka Exp $ */
/*
* Copyright (c) 1989, 1993
@ -1129,6 +1129,7 @@ void fill_eproc(struct proc *, struct eproc *, bool);
* subsystem setup
*/
void sysctl_init(void);
void sysctl_finalize(void);
/*
* typical syscall call order