xref: /freebsd/contrib/xz/src/liblzma/common/hardware_cputhreads.c (revision f126890ac5386406dadf7c4cfa9566cbb56537c5)
1 // SPDX-License-Identifier: 0BSD
2 
3 ///////////////////////////////////////////////////////////////////////////////
4 //
5 /// \file       hardware_cputhreads.c
6 /// \brief      Get the number of CPU threads or cores
7 //
8 //  Author:     Lasse Collin
9 //
10 ///////////////////////////////////////////////////////////////////////////////
11 
12 #include "common.h"
13 
14 #include "tuklib_cpucores.h"
15 
16 
17 #ifdef HAVE_SYMBOL_VERSIONS_LINUX
18 // This is for compatibility with binaries linked against liblzma that
19 // has been patched with xz-5.2.2-compat-libs.patch from RHEL/CentOS 7.
20 LZMA_SYMVER_API("lzma_cputhreads@XZ_5.2.2",
21 	uint32_t, lzma_cputhreads_522)(void) lzma_nothrow
22 		__attribute__((__alias__("lzma_cputhreads_52")));
23 
24 LZMA_SYMVER_API("lzma_cputhreads@@XZ_5.2",
25 	uint32_t, lzma_cputhreads_52)(void) lzma_nothrow;
26 
27 #define lzma_cputhreads lzma_cputhreads_52
28 #endif
29 extern LZMA_API(uint32_t)
30 lzma_cputhreads(void)
31 {
32 	return tuklib_cpucores();
33 }
34