From a0a7328bb0e44e64393c1e1be6a9621945bb8edf Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Sat, 6 Jan 2001 06:51:43 +0000 Subject: [PATCH] - Move all of the KTR sysctl's under a new debug.ktr mib. - Provide TUNABLE_INT() hooks for ktr_cpumask, ktr_mask, and ktr_verbose so that they can be set from the loader by their respective sysctl names. For example, to turn on KTR_INTR and KTR_PROC in ktr_mask, one could stick 'debug.ktr.mask="0x1200"' in /boot/loader.conf. --- sys/kern/kern_ktr.c | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/sys/kern/kern_ktr.c b/sys/kern/kern_ktr.c index 65a4ac6b22ab..1704d5dd4c48 100644 --- a/sys/kern/kern_ktr.c +++ b/sys/kern/kern_ktr.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -66,35 +67,43 @@ #endif #ifdef KTR_EXTEND +#define KTR_EXTEND_DEFAULT 1 +#else +#define KTR_EXTEND_DEFAULT 0 +#endif + +#ifdef KTR_VERBOSE +#define KTR_VERBOSE_DEFAULT 1 +#else +#define KTR_VERBOSE_DEFAULT 0 +#endif + +SYSCTL_NODE(_debug, OID_AUTO, ktr, CTLFLAG_RD, 0, "KTR options"); + /* * This variable is used only by gdb to work out what fields are in * ktr_entry. */ -int ktr_extend = 1; -SYSCTL_INT(_debug, OID_AUTO, ktr_extend, CTLFLAG_RD, &ktr_extend, 1, ""); -#else -int ktr_extend = 0; -SYSCTL_INT(_debug, OID_AUTO, ktr_extend, CTLFLAG_RD, &ktr_extend, 0, ""); -#endif /* KTR_EXTEND */ +int ktr_extend = KTR_EXTEND_DEFAULT; +SYSCTL_INT(_debug_ktr, OID_AUTO, extend, CTLFLAG_RD, &ktr_extend, 0, ""); -int ktr_cpumask = KTR_CPUMASK; -SYSCTL_INT(_debug, OID_AUTO, ktr_cpumask, CTLFLAG_RW, &ktr_cpumask, KTR_CPUMASK, ""); +int ktr_cpumask; +TUNABLE_INT_DECL("debug.ktr.cpumask", KTR_CPUMASK, ktr_cpumask); +SYSCTL_INT(_debug_ktr, OID_AUTO, cpumask, CTLFLAG_RW, &ktr_cpumask, 0, ""); -int ktr_mask = KTR_MASK; -SYSCTL_INT(_debug, OID_AUTO, ktr_mask, CTLFLAG_RW, &ktr_mask, KTR_MASK, ""); +int ktr_mask; +TUNABLE_INT_DECL("debug.ktr.mask", KTR_MASK, ktr_mask); +SYSCTL_INT(_debug_ktr, OID_AUTO, mask, CTLFLAG_RW, &ktr_mask, 0, ""); int ktr_entries = KTR_ENTRIES; -SYSCTL_INT(_debug, OID_AUTO, ktr_entries, CTLFLAG_RD, &ktr_entries, KTR_ENTRIES, ""); +SYSCTL_INT(_debug_ktr, OID_AUTO, entries, CTLFLAG_RD, &ktr_entries, 0, ""); volatile int ktr_idx = 0; struct ktr_entry ktr_buf[KTR_ENTRIES]; -#ifdef KTR_VERBOSE -int ktr_verbose = 1; -#else -int ktr_verbose = 0; -#endif -SYSCTL_INT(_debug, OID_AUTO, ktr_verbose, CTLFLAG_RW, &ktr_verbose, 0, ""); +int ktr_verbose; +TUNABLE_INT_DECL("debug.ktr.verbose", KTR_VERBOSE_DEFAULT, ktr_verbose); +SYSCTL_INT(_debug_ktr, OID_AUTO, verbose, CTLFLAG_RW, &ktr_verbose, 0, ""); #ifdef KTR #ifdef KTR_EXTEND