[PATCH] D39490: [scudo] Make getNumberOfCPUs Fuchsia compliant
Kamil Rytarowski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 2 02:06:48 PDT 2017
krytarowski added inline comments.
================
Comment at: lib/sanitizer_common/sanitizer_linux.cc:1840
+ cpu_set_t CPUs;
+ CHECK_EQ(sched_getaffinity(0, sizeof(cpu_set_t), &CPUs), 0);
+ return CPU_COUNT(&CPUs);
----------------
This breaks NetBSD. There is `sched_getaffinity_np` available in `-lrt`, however I it's better to use `sysctl` to skip unneeded dependency.
```
rugged$ sysctl -d hw.ncpuonline
hw.ncpuonline: Number of CPUs online
rugged$ sysctl -d hw.ncpu
hw.ncpu: Number of CPUs configured
```
Repository:
rL LLVM
https://reviews.llvm.org/D39490
More information about the llvm-commits
mailing list