xref: /freebsd/contrib/xz/src/liblzma/common/hardware_cputhreads.c (revision 3b35e7ee8de9b0260149a2b77e87a2b9c7a36244)
1*3b35e7eeSXin LI // SPDX-License-Identifier: 0BSD
2*3b35e7eeSXin LI 
353200025SRui Paulo ///////////////////////////////////////////////////////////////////////////////
453200025SRui Paulo //
553200025SRui Paulo /// \file       hardware_cputhreads.c
653200025SRui Paulo /// \brief      Get the number of CPU threads or cores
753200025SRui Paulo //
853200025SRui Paulo //  Author:     Lasse Collin
953200025SRui Paulo //
1053200025SRui Paulo ///////////////////////////////////////////////////////////////////////////////
1153200025SRui Paulo 
1253200025SRui Paulo #include "common.h"
1353200025SRui Paulo 
1453200025SRui Paulo #include "tuklib_cpucores.h"
1553200025SRui Paulo 
1653200025SRui Paulo 
179e6bbe47SXin LI #ifdef HAVE_SYMBOL_VERSIONS_LINUX
189e6bbe47SXin LI // This is for compatibility with binaries linked against liblzma that
199e6bbe47SXin LI // has been patched with xz-5.2.2-compat-libs.patch from RHEL/CentOS 7.
209e6bbe47SXin LI LZMA_SYMVER_API("lzma_cputhreads@XZ_5.2.2",
219e6bbe47SXin LI 	uint32_t, lzma_cputhreads_522)(void) lzma_nothrow
229e6bbe47SXin LI 		__attribute__((__alias__("lzma_cputhreads_52")));
239e6bbe47SXin LI 
249e6bbe47SXin LI LZMA_SYMVER_API("lzma_cputhreads@@XZ_5.2",
259e6bbe47SXin LI 	uint32_t, lzma_cputhreads_52)(void) lzma_nothrow;
269e6bbe47SXin LI 
279e6bbe47SXin LI #define lzma_cputhreads lzma_cputhreads_52
289e6bbe47SXin LI #endif
2953200025SRui Paulo extern LZMA_API(uint32_t)
3053200025SRui Paulo lzma_cputhreads(void)
3153200025SRui Paulo {
3253200025SRui Paulo 	return tuklib_cpucores();
3353200025SRui Paulo }
34