[sanitizer_common] Use HW_NCPUONLINE sysctl on NetBSD in GetNumberOfCPUs() (#134704)

This commit is contained in:
Brad Smith
2025-04-07 15:15:12 -04:00
committed by GitHub
parent 10bef367a5
commit 8f5a3ec649

View File

@@ -840,7 +840,11 @@ u32 GetNumberOfCPUs() {
int req[2];
uptr len = sizeof(ncpu);
req[0] = CTL_HW;
# ifdef HW_NCPUONLINE
req[1] = HW_NCPUONLINE;
# else
req[1] = HW_NCPU;
# endif
CHECK_EQ(internal_sysctl(req, 2, &ncpu, &len, NULL, 0), 0);
return ncpu;
# elif SANITIZER_SOLARIS