diff options
author | peter <peter@FreeBSD.org> | 2001-06-06 22:17:08 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2001-06-06 22:17:08 +0000 |
commit | 0732738ec450bcfa11cfc73cc53b16c92c4a5e9a (patch) | |
tree | 58ecfe664c4cc2fd28db0c76b33469ccff8dee55 /sys/kern | |
parent | 1127de3ac7859c762c70d8deecce993108ef82f3 (diff) | |
download | FreeBSD-src-0732738ec450bcfa11cfc73cc53b16c92c4a5e9a.zip FreeBSD-src-0732738ec450bcfa11cfc73cc53b16c92c4a5e9a.tar.gz |
Make the TUNABLE_*() macros look and behave more consistantly like the
SYSCTL_*() macros. TUNABLE_INT_DECL() was an odd name because it didn't
actually declare the int, which is what the name suggests it would do.
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_ktr.c | 12 | ||||
-rw-r--r-- | sys/kern/kern_linker.c | 6 | ||||
-rw-r--r-- | sys/kern/kern_malloc.c | 13 | ||||
-rw-r--r-- | sys/kern/subr_witness.c | 16 | ||||
-rw-r--r-- | sys/kern/uipc_mbuf.c | 24 | ||||
-rw-r--r-- | sys/kern/uipc_sockbuf.c | 4 | ||||
-rw-r--r-- | sys/kern/uipc_socket2.c | 4 |
7 files changed, 41 insertions, 38 deletions
diff --git a/sys/kern/kern_ktr.c b/sys/kern/kern_ktr.c index 1422a3e..80af2ab 100644 --- a/sys/kern/kern_ktr.c +++ b/sys/kern/kern_ktr.c @@ -87,12 +87,12 @@ SYSCTL_NODE(_debug, OID_AUTO, ktr, CTLFLAG_RD, 0, "KTR options"); int ktr_extend = KTR_EXTEND_DEFAULT; SYSCTL_INT(_debug_ktr, OID_AUTO, extend, CTLFLAG_RD, &ktr_extend, 0, ""); -int ktr_cpumask; -TUNABLE_INT_DECL("debug.ktr.cpumask", KTR_CPUMASK, ktr_cpumask); +int ktr_cpumask = KTR_CPUMASK; +TUNABLE_INT("debug.ktr.cpumask", &ktr_cpumask); SYSCTL_INT(_debug_ktr, OID_AUTO, cpumask, CTLFLAG_RW, &ktr_cpumask, 0, ""); -int ktr_mask; -TUNABLE_INT_DECL("debug.ktr.mask", KTR_MASK, ktr_mask); +int ktr_mask = KTR_MASK; +TUNABLE_INT("debug.ktr.mask", &ktr_mask); SYSCTL_INT(_debug_ktr, OID_AUTO, mask, CTLFLAG_RW, &ktr_mask, 0, ""); int ktr_entries = KTR_ENTRIES; @@ -101,8 +101,8 @@ SYSCTL_INT(_debug_ktr, OID_AUTO, entries, CTLFLAG_RD, &ktr_entries, 0, ""); volatile int ktr_idx = 0; struct ktr_entry ktr_buf[KTR_ENTRIES]; -int ktr_verbose; -TUNABLE_INT_DECL("debug.ktr.verbose", KTR_VERBOSE_DEFAULT, ktr_verbose); +int ktr_verbose = KTR_VERBOSE_DEFAULT; +TUNABLE_INT("debug.ktr.verbose", &ktr_verbose); SYSCTL_INT(_debug_ktr, OID_AUTO, verbose, CTLFLAG_RW, &ktr_verbose, 0, ""); #ifdef KTR diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c index e8cfb56..affc1dc 100644 --- a/sys/kern/kern_linker.c +++ b/sys/kern/kern_linker.c @@ -1208,14 +1208,12 @@ SYSINIT(preload, SI_SUB_KLD, SI_ORDER_MIDDLE, linker_preload, 0); * character as a separator to be consistent with the bootloader. */ -static char def_linker_path[] = "/boot/modules/;/modules/;/boot/kernel/"; -static char linker_path[MAXPATHLEN] = ""; +static char linker_path[MAXPATHLEN] = "/boot/modules/;/modules/;/boot/kernel/"; SYSCTL_STRING(_kern, OID_AUTO, module_path, CTLFLAG_RW, linker_path, sizeof(linker_path), "module load search path"); -TUNABLE_STR_DECL("module_path", def_linker_path, linker_path, - sizeof(linker_path)); +TUNABLE_STR("module_path", linker_path, sizeof(linker_path)); static char *linker_ext_list[] = { ".ko", diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 44666b4..f460d53 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -424,7 +424,6 @@ kmeminit(dummy) register long indx; u_long npg; u_long mem_size; - u_long xvm_kmem_size; #if ((MAXALLOCSAVE & (MAXALLOCSAVE - 1)) != 0) #error "kmeminit: MAXALLOCSAVE not power of 2" @@ -450,21 +449,21 @@ kmeminit(dummy) * Note that the kmem_map is also used by the zone allocator, * so make sure that there is enough space. */ - xvm_kmem_size = VM_KMEM_SIZE; + vm_kmem_size = VM_KMEM_SIZE; mem_size = cnt.v_page_count * PAGE_SIZE; #if defined(VM_KMEM_SIZE_SCALE) - if ((mem_size / VM_KMEM_SIZE_SCALE) > xvm_kmem_size) - xvm_kmem_size = mem_size / VM_KMEM_SIZE_SCALE; + if ((mem_size / VM_KMEM_SIZE_SCALE) > vm_kmem_size) + vm_kmem_size = mem_size / VM_KMEM_SIZE_SCALE; #endif #if defined(VM_KMEM_SIZE_MAX) - if (xvm_kmem_size >= VM_KMEM_SIZE_MAX) - xvm_kmem_size = VM_KMEM_SIZE_MAX; + if (vm_kmem_size >= VM_KMEM_SIZE_MAX) + vm_kmem_size = VM_KMEM_SIZE_MAX; #endif /* Allow final override from the kernel environment */ - TUNABLE_INT_FETCH("kern.vm.kmem.size", xvm_kmem_size, vm_kmem_size); + TUNABLE_INT_FETCH("kern.vm.kmem.size", &vm_kmem_size); /* * Limit kmem virtual size to twice the physical memory. diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c index 9ac882e..1a23ab4 100644 --- a/sys/kern/subr_witness.c +++ b/sys/kern/subr_witness.c @@ -144,8 +144,8 @@ static struct lock_instance *find_instance(struct lock_list_entry *lock_list, MALLOC_DEFINE(M_WITNESS, "witness", "witness structure"); -static int witness_watch; -TUNABLE_INT_DECL("debug.witness_watch", 1, witness_watch); +static int witness_watch = 1; +TUNABLE_INT("debug.witness_watch", &witness_watch); SYSCTL_INT(_debug, OID_AUTO, witness_watch, CTLFLAG_RD, &witness_watch, 0, ""); #ifdef DDB @@ -155,21 +155,21 @@ SYSCTL_INT(_debug, OID_AUTO, witness_watch, CTLFLAG_RD, &witness_watch, 0, ""); * - a lock heirarchy violation occurs * - locks are held when going to sleep. */ -int witness_ddb; #ifdef WITNESS_DDB -TUNABLE_INT_DECL("debug.witness_ddb", 1, witness_ddb); +int witness_ddb = 1; #else -TUNABLE_INT_DECL("debug.witness_ddb", 0, witness_ddb); +int witness_ddb = 0; #endif +TUNABLE_INT("debug.witness_ddb", &witness_ddb); SYSCTL_INT(_debug, OID_AUTO, witness_ddb, CTLFLAG_RW, &witness_ddb, 0, ""); #endif /* DDB */ -int witness_skipspin; #ifdef WITNESS_SKIPSPIN -TUNABLE_INT_DECL("debug.witness_skipspin", 1, witness_skipspin); +int witness_skipspin = 1; #else -TUNABLE_INT_DECL("debug.witness_skipspin", 0, witness_skipspin); +int witness_skipspin = 0; #endif +TUNABLE_INT("debug.witness_skipspin", &witness_skipspin); SYSCTL_INT(_debug, OID_AUTO, witness_skipspin, CTLFLAG_RD, &witness_skipspin, 0, ""); diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 1cabff7..df9db28 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -51,6 +51,10 @@ #include <vm/vm_kern.h> #include <vm/vm_extern.h> +#ifndef NMBCLUSTERS +#define NMBCLUSTERS (512 + MAXUSERS * 16) +#endif + static void mbinit(void *); SYSINIT(mbuf, SI_SUB_MBUF, SI_ORDER_FIRST, mbinit, NULL) @@ -61,8 +65,8 @@ int max_linkhdr; int max_protohdr; int max_hdr; int max_datalen; -int nmbclusters; -int nmbufs; +int nmbclusters = NMBCLUSTERS; +int nmbufs = NMBCLUSTERS * 4; int nmbcnt; u_long m_mballoc_wid = 0; u_long m_clalloc_wid = 0; @@ -99,13 +103,9 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, nmbufs, CTLFLAG_RD, &nmbufs, 0, SYSCTL_INT(_kern_ipc, OID_AUTO, nmbcnt, CTLFLAG_RD, &nmbcnt, 0, "Maximum number of ext_buf counters available"); -#ifndef NMBCLUSTERS -#define NMBCLUSTERS (512 + MAXUSERS * 16) -#endif - -TUNABLE_INT_DECL("kern.ipc.nmbclusters", NMBCLUSTERS, nmbclusters); -TUNABLE_INT_DECL("kern.ipc.nmbufs", NMBCLUSTERS * 4, nmbufs); -TUNABLE_INT_DECL("kern.ipc.nmbcnt", EXT_COUNTERS, nmbcnt); +TUNABLE_INT("kern.ipc.nmbclusters", &nmbclusters); +TUNABLE_INT("kern.ipc.nmbufs", &nmbufs); +TUNABLE_INT("kern.ipc.nmbcnt", &nmbcnt); static void m_reclaim(void); @@ -126,6 +126,12 @@ mbinit(void *dummy) vm_offset_t maxaddr; vm_size_t mb_map_size; + /* Sanity checks and pre-initialization for non-constants */ + if (nmbufs < nmbclusters * 2) + nmbufs = nmbclusters * 2; + if (nmbcnt == 0) + nmbcnt = EXT_COUNTERS; + /* * Setup the mb_map, allocate requested VM space. */ diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c index 9b23c85..970dcec 100644 --- a/sys/kern/uipc_sockbuf.c +++ b/sys/kern/uipc_sockbuf.c @@ -1012,7 +1012,7 @@ SYSCTL_INT(_kern_ipc, KIPC_SOCKBUF_WASTE, sockbuf_waste_factor, CTLFLAG_RW, */ static void init_maxsockets(void *ignored) { - TUNABLE_INT_FETCH("kern.ipc.maxsockets", 0, maxsockets); - maxsockets = imax(maxsockets, imax(maxfiles, nmbclusters)); + TUNABLE_INT_FETCH("kern.ipc.maxsockets", &maxsockets); + maxsockets = imax(maxsockets, imax(maxfiles, nmbclusters)); } SYSINIT(param, SI_SUB_TUNABLES, SI_ORDER_ANY, init_maxsockets, NULL); diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c index 9b23c85..970dcec 100644 --- a/sys/kern/uipc_socket2.c +++ b/sys/kern/uipc_socket2.c @@ -1012,7 +1012,7 @@ SYSCTL_INT(_kern_ipc, KIPC_SOCKBUF_WASTE, sockbuf_waste_factor, CTLFLAG_RW, */ static void init_maxsockets(void *ignored) { - TUNABLE_INT_FETCH("kern.ipc.maxsockets", 0, maxsockets); - maxsockets = imax(maxsockets, imax(maxfiles, nmbclusters)); + TUNABLE_INT_FETCH("kern.ipc.maxsockets", &maxsockets); + maxsockets = imax(maxsockets, imax(maxfiles, nmbclusters)); } SYSINIT(param, SI_SUB_TUNABLES, SI_ORDER_ANY, init_maxsockets, NULL); |