From b3b84d9b17ead7bcb5ce571b8b615d024ef40881 Mon Sep 17 00:00:00 2001 From: Gary Palmer Date: Thu, 25 Dec 1997 13:14:21 +0000 Subject: [PATCH] Make kern.ncpu reports the number of detected processors when running with a SMP kernel. --- sys/kern/kern_mib.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_mib.c b/sys/kern/kern_mib.c index 7cd310d702be..ad93402d2d80 100644 --- a/sys/kern/kern_mib.c +++ b/sys/kern/kern_mib.c @@ -37,7 +37,7 @@ * SUCH DAMAGE. * * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94 - * $Id: kern_mib.c,v 1.11 1997/08/30 02:52:04 kato Exp $ + * $Id: kern_mib.c,v 1.12 1997/10/19 18:45:59 davidg Exp $ */ #include @@ -48,6 +48,9 @@ #include #include +#if defined(SMP) +#include +#endif SYSCTL_NODE(, 0, sysctl, CTLFLAG_RW, 0, "Sysctl internal magic"); @@ -103,7 +106,11 @@ char kernelname[MAXPATHLEN] = "/kernel"; /* XXX bloat */ SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RW, kernelname, sizeof kernelname, ""); +#ifdef SMP +SYSCTL_INT(_hw, HW_NCPU, ncpu, CTLFLAG_RD, &mp_ncpus, 0, ""); +#else SYSCTL_INT(_hw, HW_NCPU, ncpu, CTLFLAG_RD, 0, 1, ""); +#endif SYSCTL_INT(_hw, HW_BYTEORDER, byteorder, CTLFLAG_RD, 0, BYTE_ORDER, "");