Make sure to try hw.ncpu if kern.smp.cpus doesn't exist (i.e. on UP) when

getting number of CPUs.
This commit is contained in:
Bosko Milekic 2001-06-23 17:03:27 +00:00
parent ab962c79ec
commit 4edec6b79a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=78664

View File

@ -190,7 +190,8 @@ initmbufs()
nmbtypes = mbtypeslen / sizeof(*m_mbtypes);
#endif
len = sizeof(int);
if (sysctlbyname("kern.smp.cpus", &ncpu, &len, NULL, 0) < 0) {
if (sysctlbyname("kern.smp.cpus", &ncpu, &len, NULL, 0) < 0 &&
sysctlbyname("hw.ncpu", &ncpu, &len, NULL, 0) < 0) {
error("sysctl getting number of cpus");
return 0;
}