summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkn <kn@openbsd.org>2020-08-22 11:47:22 +0000
committerkn <kn@openbsd.org>2020-08-22 11:47:22 +0000
commitc38ca5bd9490649d525e589fe88581da0148fdb2 (patch)
treee1d31670aa7bd8e65a3baecd2beab2e08316207e
parentdrm/amd/display: dchubbub p-state warning during surface planes switch (diff)
downloadwireguard-openbsd-c38ca5bd9490649d525e589fe88581da0148fdb2.tar.xz
wireguard-openbsd-c38ca5bd9490649d525e589fe88581da0148fdb2.zip
Move sysctl(2) CTL_DEBUG from DEBUG to new DEBUG_SYSCTL
Adding "debug.my-knob" sysctls is really helpful to select different code paths and/or log on demand during runtime without recompile, but as this code is under DEBUG, lots of other noise comes with it which is often undesired, at least when looking at specific subsystems only. Adding globals to the kernel and breaking into DDB to change them helps, but that does not work over SSH, hence the need for debug sysctls. Introduces DEBUG_SYSCTL to make use of the "debug" MIB without the rest of DEBUG; it's DEBUG_SYSCTL and not SYSCTL_DEBUG because it's not a general option for all of sysctl(2). OK gnezdo
-rw-r--r--sys/kern/kern_sysctl.c8
-rw-r--r--sys/kern/vfs_subr.c6
-rw-r--r--sys/kern/vfs_syscalls.c4
-rw-r--r--sys/sys/sysctl.h8
4 files changed, 13 insertions, 13 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 7615cbbd28f..c948edc91af 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.376 2020/08/18 18:19:30 gnezdo Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.377 2020/08/22 11:47:23 kn Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -213,7 +213,7 @@ sys_sysctl(struct proc *p, void *v, register_t *retval)
case CTL_MACHDEP:
fn = cpu_sysctl;
break;
-#ifdef DEBUG
+#ifdef DEBUG_SYSCTL
case CTL_DEBUG:
fn = debug_sysctl;
break;
@@ -809,7 +809,7 @@ hw_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
/* NOTREACHED */
}
-#ifdef DEBUG
+#ifdef DEBUG_SYSCTL
/*
* Debugging related system variables.
*/
@@ -848,7 +848,7 @@ debug_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
}
/* NOTREACHED */
}
-#endif /* DEBUG */
+#endif /* DEBUG_SYSCTL */
/*
* Reads, or writes that lower the value
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 8c015e44e40..6ea2cd63cc0 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_subr.c,v 1.301 2020/03/27 07:58:17 anton Exp $ */
+/* $OpenBSD: vfs_subr.c,v 1.302 2020/08/22 11:47:23 kn Exp $ */
/* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */
/*
@@ -864,7 +864,7 @@ vdrop(struct vnode *vp)
* system error). If MNT_FORCE is specified, detach any active vnodes
* that are found.
*/
-#ifdef DEBUG
+#ifdef DEBUG_SYSCTL
int busyprt = 0; /* print out busy vnodes */
struct ctldebug debug1 = { "busyprt", &busyprt };
#endif
@@ -953,7 +953,7 @@ vflush_vnode(struct vnode *vp, void *arg)
LIST_EMPTY(&vp->v_dirtyblkhd))
return (0);
-#ifdef DEBUG
+#ifdef DEBUG_SYSCTL
if (busyprt)
vprint("vflush: busy vnode", vp);
#endif
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index f195ac991dc..4f22f24a152 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_syscalls.c,v 1.345 2020/06/24 22:03:42 cheloha Exp $ */
+/* $OpenBSD: vfs_syscalls.c,v 1.346 2020/08/22 11:47:23 kn Exp $ */
/* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */
/*
@@ -523,7 +523,7 @@ dounmount_leaf(struct mount *mp, int flags, struct proc *p)
/*
* Sync each mounted filesystem.
*/
-#ifdef DEBUG
+#ifdef DEBUG_SYSCTL
int syncprt = 0;
struct ctldebug debug0 = { "syncprt", &syncprt };
#endif
diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h
index 31987a5d963..aaf36163387 100644
--- a/sys/sys/sysctl.h
+++ b/sys/sys/sysctl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysctl.h,v 1.208 2020/08/18 04:48:12 gnezdo Exp $ */
+/* $OpenBSD: sysctl.h,v 1.209 2020/08/22 11:47:22 kn Exp $ */
/* $NetBSD: sysctl.h,v 1.16 1996/04/09 20:55:36 cgd Exp $ */
/*
@@ -957,7 +957,7 @@ struct kinfo_file {
#define CTL_DEBUG_MAXID 20
#ifdef _KERNEL
-#ifdef DEBUG
+#ifdef DEBUG_SYSCTL
/*
* CTL_DEBUG variables.
*
@@ -978,7 +978,7 @@ extern struct ctldebug debug0, debug1, debug2, debug3, debug4;
extern struct ctldebug debug5, debug6, debug7, debug8, debug9;
extern struct ctldebug debug10, debug11, debug12, debug13, debug14;
extern struct ctldebug debug15, debug16, debug17, debug18, debug19;
-#endif /* DEBUG */
+#endif /* DEBUG_SYSCTL */
/*
* Exported sysctl variable with valid bounds. Both bounds are inclusive to
@@ -1037,7 +1037,7 @@ int kern_sysctl(int *, u_int, void *, size_t *, void *, size_t,
struct proc *);
int hw_sysctl(int *, u_int, void *, size_t *, void *, size_t,
struct proc *);
-#ifdef DEBUG
+#ifdef DEBUG_SYSCTL
int debug_sysctl(int *, u_int, void *, size_t *, void *, size_t,
struct proc *);
#endif