Skip to content

Commit 8f5a3ec

Browse files
authored
[sanitizer_common] Use HW_NCPUONLINE sysctl on NetBSD in GetNumberOfCPUs() (#134704)
1 parent 10bef36 commit 8f5a3ec

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,11 @@ u32 GetNumberOfCPUs() {
840840
int req[2];
841841
uptr len = sizeof(ncpu);
842842
req[0] = CTL_HW;
843+
# ifdef HW_NCPUONLINE
844+
req[1] = HW_NCPUONLINE;
845+
# else
843846
req[1] = HW_NCPU;
847+
# endif
844848
CHECK_EQ(internal_sysctl(req, 2, &ncpu, &len, NULL, 0), 0);
845849
return ncpu;
846850
# elif SANITIZER_SOLARIS

0 commit comments

Comments
 (0)