summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pmcstat
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2008-01-10 16:31:14 +0000
committerjkim <jkim@FreeBSD.org>2008-01-10 16:31:14 +0000
commit951f756a2b461d2f96020c225acf6aff6078af97 (patch)
tree49617b73e5b6d072c2cfadf85027e90f16931e0e /usr.sbin/pmcstat
parent8f9a1372cf264bb94f248f95382d4bb9fe1d9928 (diff)
downloadFreeBSD-src-951f756a2b461d2f96020c225acf6aff6078af97.zip
FreeBSD-src-951f756a2b461d2f96020c225acf6aff6078af97.tar.gz
Fix non-SMP kernel regression introduced in the previous commit.
Reviewed by: jkoshy
Diffstat (limited to 'usr.sbin/pmcstat')
-rw-r--r--usr.sbin/pmcstat/pmcstat.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.sbin/pmcstat/pmcstat.c b/usr.sbin/pmcstat/pmcstat.c
index 1d7724e..0fe0619 100644
--- a/usr.sbin/pmcstat/pmcstat.c
+++ b/usr.sbin/pmcstat/pmcstat.c
@@ -580,10 +580,13 @@ main(int argc, char **argv)
if (sysctlbyname("hw.ncpu", &ncpu, &dummy, NULL, 0) < 0)
err(EX_OSERR, "ERROR: Cannot determine the number of CPUs");
cpumask = (1 << ncpu) - 1;
- if (sysctlbyname("machdep.hlt_cpus", &haltedcpus, &dummy,
- NULL, 0) < 0)
- err(EX_OSERR, "ERROR: Cannot determine which CPUs are halted");
- cpumask &= ~haltedcpus;
+ if (ncpu > 1) {
+ if (sysctlbyname("machdep.hlt_cpus", &haltedcpus, &dummy,
+ NULL, 0) < 0)
+ err(EX_OSERR, "ERROR: Cannot determine which CPUs are "
+ "halted");
+ cpumask &= ~haltedcpus;
+ }
while ((option = getopt(argc, argv,
"CD:EG:M:NO:P:R:S:Wc:dgk:n:o:p:qr:s:t:vw:z:")) != -1)
OpenPOWER on IntegriCloud