hardware_cputhreads.c 927 B

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