From bcba261a2c3549d38d3f6165116cdda5909077c9 Mon Sep 17 00:00:00 2001 From: Jung-uk Kim Date: Thu, 10 Jan 2008 16:31:14 +0000 Subject: Fix non-SMP kernel regression introduced in the previous commit. Reviewed by: jkoshy --- usr.sbin/pmcstat/pmcstat.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'usr.sbin/pmcstat') diff --git a/usr.sbin/pmcstat/pmcstat.c b/usr.sbin/pmcstat/pmcstat.c index 1d7724e73edf..0fe06194d044 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) -- cgit v1.2.3