summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLandry Breuil <landry@openbsd.org>2022-05-06 10:51:36 +0200
committerLandry Breuil <landry@openbsd.org>2022-05-06 10:51:36 +0200
commitc65719b613318b48b8a1bb2cc72e49bb8f592088 (patch)
treeb7d81ab08c29a704a309bb344bc14c3a6baad984
parent4f39d8167e9a5b9270d777bb932353e8e0724c9f (diff)
downloadnspr-hg-c65719b613318b48b8a1bb2cc72e49bb8f592088.tar.gz
Bug 1768141 - Use HW_NCPUONLINE if available in PR_GetNumberOfProcessors(). r=kaie
-rw-r--r--pr/src/misc/prsystem.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/pr/src/misc/prsystem.c b/pr/src/misc/prsystem.c
index 109f1ed2..dba093e9 100644
--- a/pr/src/misc/prsystem.c
+++ b/pr/src/misc/prsystem.c
@@ -206,7 +206,11 @@ PR_IMPLEMENT(PRInt32) PR_GetNumberOfProcessors( void )
size_t len = sizeof(numCpus);
mib[0] = CTL_HW;
+#ifdef HW_NCPUONLINE
+ mib[1] = HW_NCPUONLINE;
+#else
mib[1] = HW_NCPU;
+#endif
rc = sysctl( mib, 2, &numCpus, &len, NULL, 0 );
if ( -1 == rc ) {
numCpus = -1; /* set to -1 for return value on error */