aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-06-03 08:55:24 -0700
committerJunio C Hamano <gitster@pobox.com>2025-06-03 08:55:24 -0700
commit2beccb38fccb1f5a0cf709e1dcd6f5970b123c7e (patch)
treeb98d65a8c6155d17b3c931e9782d0938190a736d
parentd9a1e51c76818858d1bc59d1a2a056a1e1df1c41 (diff)
parent7f1a09dbb643c8669928ee32337ff92370fc1157 (diff)
downloadgit-2beccb38fccb1f5a0cf709e1dcd6f5970b123c7e.tar.xz
Merge branch 'bs/online-cpus-bsd'
Update online_cpus() functrion on BSD variants. * bs/online-cpus-bsd: thread-utils.c: detect online CPU count on OpenBSD / NetBSD
-rw-r--r--thread-utils.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/thread-utils.c b/thread-utils.c
index 1f89ffab4c..374890e6b0 100644
--- a/thread-utils.c
+++ b/thread-utils.c
@@ -46,11 +46,11 @@ int online_cpus(void)
mib[0] = CTL_HW;
# ifdef HW_AVAILCPU
mib[1] = HW_AVAILCPU;
- len = sizeof(cpucount);
- if (!sysctl(mib, 2, &cpucount, &len, NULL, 0))
- return cpucount;
-# endif /* HW_AVAILCPU */
+# elif defined(HW_NCPUONLINE)
+ mib[1] = HW_NCPUONLINE;
+# else
mib[1] = HW_NCPU;
+# endif /* HW_AVAILCPU */
len = sizeof(cpucount);
if (!sysctl(mib, 2, &cpucount, &len, NULL, 0))
return cpucount;