summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2017-03-16 10:05:48 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2017-03-16 10:05:48 +0000
commit8209a6b721c598b6d7c079c4224f8268b1af615e (patch)
tree7415f8739859b4e64f683dace8d7069bcdc8ac1b
parent167213b3969aab638f9ea2aaef63bfe3619cc135 (diff)
Fix a regression preventing ``kern.profiling'' to return the profiling
state even with a correct kernel. Reported by jmc@, ok tb@
-rw-r--r--sbin/sysctl/sysctl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index 41aeda92402..fd8e766cd9e 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysctl.c,v 1.224 2016/12/22 11:04:44 rzalamena Exp $ */
+/* $OpenBSD: sysctl.c,v 1.225 2017/03/16 10:05:47 mpi Exp $ */
/* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */
/*
@@ -340,8 +340,9 @@ parse(char *string, int flags)
switch (mib[1]) {
case KERN_PROF:
mib[2] = GPROF_STATE;
+ mib[3] = 0; /* Assume CPU ID 0 is always valid. */
size = sizeof(state);
- if (sysctl(mib, 3, &state, &size, NULL, 0) == -1) {
+ if (sysctl(mib, 4, &state, &size, NULL, 0) == -1) {
if (flags == 0)
return;
if (!nflag)