]> git.ipfire.org Git - thirdparty/zstd.git/commit
Fix #1425 - Use physical core count API on FreeBSD 1491/head
authorConrad Meyer <cem@FreeBSD.org>
Fri, 4 Jan 2019 19:57:12 +0000 (11:57 -0800)
committerConrad Meyer <cem@FreeBSD.org>
Fri, 4 Jan 2019 19:57:12 +0000 (11:57 -0800)
commitfe82637069bfdf09c9fcb45076379fd79291d09a
treea698be37a398fc931490aae1971f5d0f08d48182
parentb174809fcce6f2306b4209b5191798c1e85eceda
Fix #1425 - Use physical core count API on FreeBSD

Similar to Apple, use the native physical core count sysctl, when available.

This is a little repetitive (it's basically the __APPLE__ method plus the
otherBSD method concatenated together) but seemed clearer than any way that
would totally eliminate repetition.

The __FreeBSD_version check only tests the version of the FreeBSD kernel
that zstd is compiled on; importantly, it may be run on a different version.
So the compile-time check is a little naive and needs to be able to fallback
to work on older versions of FreeBSD.  For a similar reason, it may make
sense to simply eliminate the __FreeBSD_version check entirely.  The
tradeoff is that a spurious sysctlbyname would be issued when -T0 is used on
older kernels.
programs/util.c