diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2022-10-20 20:22:50 +0300 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2022-10-20 20:22:50 +0300 |
commit | 2611c4d90535652d3eb7ef4a026a6691276fab43 (patch) | |
tree | 7277997b90b6b812d101c45e8ef0b84613b81f3f /m4/tuklib_cpucores.m4 | |
parent | Tests: Skip tests in test_*.sh if encoders and/or decoders are disabled. (diff) | |
download | xz-2611c4d90535652d3eb7ef4a026a6691276fab43.tar.xz |
tuklib_cpucores: Use HW_NCPUONLINE on OpenBSD.
On OpenBSD the number of cores online is often less
than what HW_NCPU would return because OpenBSD disables
simultaneous multi-threading (SMT) by default.
Thanks to Christian Weisgerber.
Diffstat (limited to 'm4/tuklib_cpucores.m4')
-rw-r--r-- | m4/tuklib_cpucores.m4 | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/m4/tuklib_cpucores.m4 b/m4/tuklib_cpucores.m4 index 63063982..873812d6 100644 --- a/m4/tuklib_cpucores.m4 +++ b/m4/tuklib_cpucores.m4 @@ -102,7 +102,12 @@ compile error int main(void) { +#ifdef HW_NCPUONLINE + /* This is preferred on OpenBSD, see tuklib_cpucores.c. */ + int name[2] = { CTL_HW, HW_NCPUONLINE }; +#else int name[2] = { CTL_HW, HW_NCPU }; +#endif int cpus; size_t cpus_size = sizeof(cpus); sysctl(name, 2, &cpus, &cpus_size, NULL, 0); |