Module Name:    src
Committed By:   pooka
Date:           Wed Sep 16 15:23:05 UTC 2009

Modified Files:
        src/sys/kern: init_main.c kern_sysctl.c subr_autoconf.c subr_bufq.c
            subr_iostat.c uipc_accf.c
        src/sys/miscfs/syncfs: sync_subr.c
        src/sys/net: if.c route.c rtsock.c
        src/sys/netinet: if_arp.c igmp.c in_proto.c ip_carp.c ip_carp.h
            ip_icmp.c ip_input.c raw_ip.c tcp_subr.c tcp_usrreq.c tcp_var.h
            udp_usrreq.c
        src/sys/netinet6: icmp6.c ip6_input.c ip6_mroute.c raw_ip6.c
            udp6_usrreq.c
        src/sys/rump/librump/rumpkern: rump.c
        src/sys/sys: sysctl.h

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.399 -r1.400 src/sys/kern/init_main.c
cvs rdiff -u -r1.225 -r1.226 src/sys/kern/kern_sysctl.c
cvs rdiff -u -r1.181 -r1.182 src/sys/kern/subr_autoconf.c
cvs rdiff -u -r1.18 -r1.19 src/sys/kern/subr_bufq.c
cvs rdiff -u -r1.17 -r1.18 src/sys/kern/subr_iostat.c
cvs rdiff -u -r1.8 -r1.9 src/sys/kern/uipc_accf.c
cvs rdiff -u -r1.40 -r1.41 src/sys/miscfs/syncfs/sync_subr.c
cvs rdiff -u -r1.236 -r1.237 src/sys/net/if.c
cvs rdiff -u -r1.117 -r1.118 src/sys/net/route.c
cvs rdiff -u -r1.126 -r1.127 src/sys/net/rtsock.c
cvs rdiff -u -r1.146 -r1.147 src/sys/netinet/if_arp.c
cvs rdiff -u -r1.50 -r1.51 src/sys/netinet/igmp.c
cvs rdiff -u -r1.98 -r1.99 src/sys/netinet/in_proto.c
cvs rdiff -u -r1.38 -r1.39 src/sys/netinet/ip_carp.c
cvs rdiff -u -r1.5 -r1.6 src/sys/netinet/ip_carp.h
cvs rdiff -u -r1.120 -r1.121 src/sys/netinet/ip_icmp.c
cvs rdiff -u -r1.283 -r1.284 src/sys/netinet/ip_input.c
cvs rdiff -u -r1.109 -r1.110 src/sys/netinet/raw_ip.c
cvs rdiff -u -r1.237 -r1.238 src/sys/netinet/tcp_subr.c
cvs rdiff -u -r1.156 -r1.157 src/sys/netinet/tcp_usrreq.c
cvs rdiff -u -r1.161 -r1.162 src/sys/netinet/tcp_var.h
cvs rdiff -u -r1.178 -r1.179 src/sys/netinet/udp_usrreq.c
cvs rdiff -u -r1.152 -r1.153 src/sys/netinet6/icmp6.c
cvs rdiff -u -r1.127 -r1.128 src/sys/netinet6/ip6_input.c
cvs rdiff -u -r1.97 -r1.98 src/sys/netinet6/ip6_mroute.c
cvs rdiff -u -r1.104 -r1.105 src/sys/netinet6/raw_ip6.c
cvs rdiff -u -r1.87 -r1.88 src/sys/netinet6/udp6_usrreq.c
cvs rdiff -u -r1.114 -r1.115 src/sys/rump/librump/rumpkern/rump.c
cvs rdiff -u -r1.186 -r1.187 src/sys/sys/sysctl.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/init_main.c
diff -u src/sys/kern/init_main.c:1.399 src/sys/kern/init_main.c:1.400
--- src/sys/kern/init_main.c:1.399	Sun Sep 13 18:45:10 2009
+++ src/sys/kern/init_main.c	Wed Sep 16 15:23:04 2009
@@ -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 @@
 	 */
 	config_finalize();
 
+	sysctl_finalize();
+
 	/*
 	 * Now that autoconfiguration has completed, we can determine
 	 * the root and dump devices.

Index: src/sys/kern/kern_sysctl.c
diff -u src/sys/kern/kern_sysctl.c:1.225 src/sys/kern/kern_sysctl.c:1.226
--- src/sys/kern/kern_sysctl.c:1.225	Mon Aug 24 20:53:00 2009
+++ src/sys/kern/kern_sysctl.c	Wed Sep 16 15:23:04 2009
@@ -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 @@
 		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.
-	 */
-	sysctl_root.sysctl_flags |= CTLFLAG_PERMANENT;
+/*
+ * 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)
+{
 
+	sysctl_root.sysctl_flags |= CTLFLAG_PERMANENT;
 }
 
 /*

Index: src/sys/kern/subr_autoconf.c
diff -u src/sys/kern/subr_autoconf.c:1.181 src/sys/kern/subr_autoconf.c:1.182
--- src/sys/kern/subr_autoconf.c:1.181	Sun Sep  6 16:18:56 2009
+++ src/sys/kern/subr_autoconf.c	Wed Sep 16 15:23:04 2009
@@ -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_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 @@
 
 	initcftable.ct_cfdata = cfdata;
 	TAILQ_INSERT_TAIL(&allcftables, &initcftable, ct_list);
+	sysctl_detach_setup(NULL);
 
 	config_initialized = 1;
 }
@@ -2578,7 +2581,8 @@
 	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;
 

Index: src/sys/kern/subr_bufq.c
diff -u src/sys/kern/subr_bufq.c:1.18 src/sys/kern/subr_bufq.c:1.19
--- src/sys/kern/subr_bufq.c:1.18	Mon Jan 19 14:54:28 2009
+++ src/sys/kern/subr_bufq.c	Wed Sep 16 15:23:04 2009
@@ -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 @@
 #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 @@
 	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 @@
 	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;
 

Index: src/sys/kern/subr_iostat.c
diff -u src/sys/kern/subr_iostat.c:1.17 src/sys/kern/subr_iostat.c:1.18
--- src/sys/kern/subr_iostat.c:1.17	Sat Apr  4 07:30:10 2009
+++ src/sys/kern/subr_iostat.c	Wed Sep 16 15:23:04 2009
@@ -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 @@
 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 @@
 {
 
 	rw_init(&iostatlist_lock);
+	sysctl_io_stats_setup(NULL);
 }
 
 /*
@@ -376,7 +379,8 @@
 	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,

Index: src/sys/kern/uipc_accf.c
diff -u src/sys/kern/uipc_accf.c:1.8 src/sys/kern/uipc_accf.c:1.9
--- src/sys/kern/uipc_accf.c:1.8	Thu Nov 20 10:00:54 2008
+++ src/sys/kern/uipc_accf.c	Wed Sep 16 15:23:04 2009
@@ -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 @@
 /*
  * 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 @@
 {
 
 	rw_init(&accept_filter_lock);
+	sysctl_net_inet_accf_setup(NULL);
 
 	return 0;
 }

Index: src/sys/miscfs/syncfs/sync_subr.c
diff -u src/sys/miscfs/syncfs/sync_subr.c:1.40 src/sys/miscfs/syncfs/sync_subr.c:1.41
--- src/sys/miscfs/syncfs/sync_subr.c:1.40	Sun Mar 15 17:22:38 2009
+++ src/sys/miscfs/syncfs/sync_subr.c	Wed Sep 16 15:23:04 2009
@@ -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 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 @@
 
 	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 @@
 	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;
         

Index: src/sys/net/if.c
diff -u src/sys/net/if.c:1.236 src/sys/net/if.c:1.237
--- src/sys/net/if.c:1.236	Tue Sep 15 23:24:34 2009
+++ src/sys/net/if.c	Wed Sep 16 15:23:04 2009
@@ -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 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 @@
 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 @@
 		       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 */

Index: src/sys/net/route.c
diff -u src/sys/net/route.c:1.117 src/sys/net/route.c:1.118
--- src/sys/net/route.c:1.117	Thu Apr  2 21:02:06 2009
+++ src/sys/net/route.c	Wed Sep 16 15:23:04 2009
@@ -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 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 @@
 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",

Index: src/sys/net/rtsock.c
diff -u src/sys/net/rtsock.c:1.126 src/sys/net/rtsock.c:1.127
--- src/sys/net/rtsock.c:1.126	Sat Sep 12 18:09:25 2009
+++ src/sys/net/rtsock.c	Wed Sep 16 15:23:04 2009
@@ -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_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 @@
 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 @@
 	.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;
 

Index: src/sys/netinet/if_arp.c
diff -u src/sys/netinet/if_arp.c:1.146 src/sys/netinet/if_arp.c:1.147
--- src/sys/netinet/if_arp.c:1.146	Wed Aug 12 22:16:15 2009
+++ src/sys/netinet/if_arp.c	Wed Sep 16 15:23:04 2009
@@ -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 @@
 
 #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 @@
 	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;
 

Index: src/sys/netinet/igmp.c
diff -u src/sys/netinet/igmp.c:1.50 src/sys/netinet/igmp.c:1.51
--- src/sys/netinet/igmp.c:1.50	Sun Sep 13 18:45:11 2009
+++ src/sys/netinet/igmp.c	Wed Sep 16 15:23:04 2009
@@ -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 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 @@
 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 @@
 	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,

Index: src/sys/netinet/in_proto.c
diff -u src/sys/netinet/in_proto.c:1.98 src/sys/netinet/in_proto.c:1.99
--- src/sys/netinet/in_proto.c:1.98	Mon Sep 14 10:36:50 2009
+++ src/sys/netinet/in_proto.c	Wed Sep 16 15:23:05 2009
@@ -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 @@
 	.pr_output = rip_output,
 	.pr_ctloutput = rip_ctloutput,
 	.pr_usrreq = rip_usrreq,
+	.pr_init = carp_init,
 },
 #endif /* NCARP > 0 */
 #if NPFSYNC > 0

Index: src/sys/netinet/ip_carp.c
diff -u src/sys/netinet/ip_carp.c:1.38 src/sys/netinet/ip_carp.c:1.39
--- src/sys/netinet/ip_carp.c:1.38	Sun Jun  7 06:11:18 2009
+++ src/sys/netinet/ip_carp.c	Wed Sep 16 15:23:05 2009
@@ -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_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 @@
 	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,

Index: src/sys/netinet/ip_carp.h
diff -u src/sys/netinet/ip_carp.h:1.5 src/sys/netinet/ip_carp.h:1.6
--- src/sys/netinet/ip_carp.h:1.5	Wed Apr 16 20:58:35 2008
+++ src/sys/netinet/ip_carp.h	Wed Sep 16 15:23:05 2009
@@ -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 @@
 }
 
 #ifdef _KERNEL
+void		 carp_init(void);
 void		 carp_ifdetach (struct ifnet *);
 void		 carp_proto_input (struct mbuf *, ...);
 void		 carp_carpdev_state(void *);

Index: src/sys/netinet/ip_icmp.c
diff -u src/sys/netinet/ip_icmp.c:1.120 src/sys/netinet/ip_icmp.c:1.121
--- src/sys/netinet/ip_icmp.c:1.120	Wed Jun 18 09:06:28 2008
+++ src/sys/netinet/ip_icmp.c	Wed Sep 16 15:23:05 2009
@@ -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 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 @@
 	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,

Index: src/sys/netinet/ip_input.c
diff -u src/sys/netinet/ip_input.c:1.283 src/sys/netinet/ip_input.c:1.284
--- src/sys/netinet/ip_input.c:1.283	Fri Jul 17 18:09:25 2009
+++ src/sys/netinet/ip_input.c	Wed Sep 16 15:23:05 2009
@@ -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_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 @@
 	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 @@
 	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;
 

Index: src/sys/netinet/raw_ip.c
diff -u src/sys/netinet/raw_ip.c:1.109 src/sys/netinet/raw_ip.c:1.110
--- src/sys/netinet/raw_ip.c:1.109	Mon Jan 19 02:27:57 2009
+++ src/sys/netinet/raw_ip.c	Wed Sep 16 15:23:05 2009
@@ -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_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 @@
 rip_init(void)
 {
 
+	sysctl_net_inet_raw_setup(NULL);
 	in_pcbinit(&rawcbtable, 1, 1);
 }
 
@@ -696,7 +699,8 @@
 	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,

Index: src/sys/netinet/tcp_subr.c
diff -u src/sys/netinet/tcp_subr.c:1.237 src/sys/netinet/tcp_subr.c:1.238
--- src/sys/netinet/tcp_subr.c:1.237	Wed May 27 17:41:03 2009
+++ src/sys/netinet/tcp_subr.c	Wed Sep 16 15:23:05 2009
@@ -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 @@
 	icmp6_mtudisc_callback_register(tcp6_mtudisc_callback);
 #endif
 
+	tcp_usrreq_init();
+
 	/* Initialize timer state. */
 	tcp_timer_init();
 

Index: src/sys/netinet/tcp_usrreq.c
diff -u src/sys/netinet/tcp_usrreq.c:1.156 src/sys/netinet/tcp_usrreq.c:1.157
--- src/sys/netinet/tcp_usrreq.c:1.156	Wed Sep  9 22:41:28 2009
+++ src/sys/netinet/tcp_usrreq.c	Wed Sep 16 15:23:05 2009
@@ -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 @@
 		       NULL, 0, &tcp_abc_aggressive, 0, CTL_CREATE, CTL_EOL);
 }
 
-/*
- * Sysctl for tcp variables.
- */
-#ifdef INET
-SYSCTL_SETUP(sysctl_net_inet_tcp_setup, "sysctl net.inet.tcp subtree setup")
+void
+tcp_usrreq_init(void)
 {
 
-	sysctl_net_inet_tcp_setup2(clog, PF_INET, "inet", "tcp");
-}
-#endif /* INET */
-
+#ifdef 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 */

Index: src/sys/netinet/tcp_var.h
diff -u src/sys/netinet/tcp_var.h:1.161 src/sys/netinet/tcp_var.h:1.162
--- src/sys/netinet/tcp_var.h:1.161	Wed Sep  9 22:41:28 2009
+++ src/sys/netinet/tcp_var.h	Wed Sep 16 15:23:05 2009
@@ -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 @@
 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);

Index: src/sys/netinet/udp_usrreq.c
diff -u src/sys/netinet/udp_usrreq.c:1.178 src/sys/netinet/udp_usrreq.c:1.179
--- src/sys/netinet/udp_usrreq.c:1.178	Sun Jul 19 23:17:33 2009
+++ src/sys/netinet/udp_usrreq.c	Wed Sep 16 15:23:05 2009
@@ -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 @@
 
 #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 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,

Index: src/sys/netinet6/icmp6.c
diff -u src/sys/netinet6/icmp6.c:1.152 src/sys/netinet6/icmp6.c:1.153
--- src/sys/netinet6/icmp6.c:1.152	Wed Mar 18 16:00:22 2009
+++ src/sys/netinet6/icmp6.c	Wed Sep 16 15:23:05 2009
@@ -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 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 @@
 	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 */
 

Index: src/sys/netinet6/ip6_input.c
diff -u src/sys/netinet6/ip6_input.c:1.127 src/sys/netinet6/ip6_input.c:1.128
--- src/sys/netinet6/ip6_input.c:1.127	Fri May  1 03:23:39 2009
+++ src/sys/netinet6/ip6_input.c	Wed Sep 16 15:23:05 2009
@@ -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 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 @@
 	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 @@
 	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))

Index: src/sys/netinet6/ip6_mroute.c
diff -u src/sys/netinet6/ip6_mroute.c:1.97 src/sys/netinet6/ip6_mroute.c:1.98
--- src/sys/netinet6/ip6_mroute.c:1.97	Wed Mar 18 16:00:23 2009
+++ src/sys/netinet6/ip6_mroute.c	Wed Sep 16 15:23:05 2009
@@ -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 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 @@
 pim6_init(void)
 {
 
+	sysctl_net_inet6_pim6_setup(NULL);
 	pim6stat_percpu = percpu_alloc(sizeof(uint64_t) * PIM6_NSTATS);
 }
 
@@ -1934,7 +1936,8 @@
 	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,

Index: src/sys/netinet6/raw_ip6.c
diff -u src/sys/netinet6/raw_ip6.c:1.104 src/sys/netinet6/raw_ip6.c:1.105
--- src/sys/netinet6/raw_ip6.c:1.104	Wed May  6 21:41:59 2009
+++ src/sys/netinet6/raw_ip6.c	Wed Sep 16 15:23:05 2009
@@ -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 @@
 
 #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 @@
 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 @@
 	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,

Index: src/sys/netinet6/udp6_usrreq.c
diff -u src/sys/netinet6/udp6_usrreq.c:1.87 src/sys/netinet6/udp6_usrreq.c:1.88
--- src/sys/netinet6/udp6_usrreq.c:1.87	Wed Mar 18 16:00:23 2009
+++ src/sys/netinet6/udp6_usrreq.c	Wed Sep 16 15:23:05 2009
@@ -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 @@
 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 @@
 	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,

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.114 src/sys/rump/librump/rumpkern/rump.c:1.115
--- src/sys/rump/librump/rumpkern/rump.c:1.114	Sun Sep 13 19:09:13 2009
+++ src/sys/rump/librump/rumpkern/rump.c	Wed Sep 16 15:23:05 2009
@@ -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 @@
 	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 @@
 			panic("aiodoned");
 	}
 
+	sysctl_finalize();
+
 	rumpuser_gethostname(hostname, MAXHOSTNAMELEN, &error);
 	hostnamelen = strlen(hostname);
 

Index: src/sys/sys/sysctl.h
diff -u src/sys/sys/sysctl.h:1.186 src/sys/sys/sysctl.h:1.187
--- src/sys/sys/sysctl.h:1.186	Fri Aug 21 22:51:00 2009
+++ src/sys/sys/sysctl.h	Wed Sep 16 15:23:05 2009
@@ -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 @@
  * subsystem setup
  */
 void	sysctl_init(void);
+void	sysctl_finalize(void);
 
 /*
  * typical syscall call order

Reply via email to