Skip to content

Commit

Permalink
[CMake] Delete HAVE_SCHED_GETAFFINITY and HAVE_CPU_COUNT
Browse files Browse the repository at this point in the history
sched_getaffinity (Linux specific) has been available

* in glibc since 2002-08-08 (commit 972e719e8154eec5f543b027e2a08dfa285d55d5)
* in musl since the initial check-in.
  • Loading branch information
MaskRay committed Apr 19, 2020
1 parent a2eb55d commit 041a355
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 13 deletions.
2 changes: 0 additions & 2 deletions llvm/cmake/config-ix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,6 @@ if( LLVM_USING_GLIBC )
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE")
endif()
# This check requires _GNU_SOURCE
check_symbol_exists(sched_getaffinity sched.h HAVE_SCHED_GETAFFINITY)
check_symbol_exists(CPU_COUNT sched.h HAVE_CPU_COUNT)
if (NOT PURE_WINDOWS)
if (LLVM_PTHREAD_LIB)
list(APPEND CMAKE_REQUIRED_LIBRARIES ${LLVM_PTHREAD_LIB})
Expand Down
6 changes: 0 additions & 6 deletions llvm/include/llvm/Config/config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,6 @@
/* Define to 1 if you have the `setenv' function. */
#cmakedefine HAVE_SETENV ${HAVE_SETENV}

/* Define to 1 if you have the `sched_getaffinity' function. */
#cmakedefine HAVE_SCHED_GETAFFINITY ${HAVE_SCHED_GETAFFINITY}

/* Define to 1 if you have the `CPU_COUNT' macro. */
#cmakedefine HAVE_CPU_COUNT ${HAVE_CPU_COUNT}

/* Define to 1 if you have the `setrlimit' function. */
#cmakedefine HAVE_SETRLIMIT ${HAVE_SETRLIMIT}

Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Support/Unix/Threading.inc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#endif

#if defined(__linux__)
#include <sched.h> // For sched_getaffinity
#include <sys/syscall.h> // For syscall codes
#include <unistd.h> // For syscall()
#endif
Expand Down Expand Up @@ -271,7 +272,7 @@ SetThreadPriorityResult llvm::set_thread_priority(ThreadPriority Priority) {
#include <thread>

int computeHostNumHardwareThreads() {
#if defined(HAVE_SCHED_GETAFFINITY) && defined(HAVE_CPU_COUNT)
#ifdef __linux__
cpu_set_t Set;
if (sched_getaffinity(0, sizeof(Set), &Set) == 0)
return CPU_COUNT(&Set);
Expand Down
4 changes: 0 additions & 4 deletions llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,6 @@ write_cmake_config("config") {
"HAVE_LSEEK64=1",
"HAVE_MALLINFO=1",
"HAVE_POSIX_FALLOCATE=1",
"HAVE_SCHED_GETAFFINITY=1",
"HAVE_CPU_COUNT=1",
"HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC=1",
]
} else {
Expand All @@ -152,8 +150,6 @@ write_cmake_config("config") {
"HAVE_LSEEK64=",
"HAVE_MALLINFO=",
"HAVE_POSIX_FALLOCATE=",
"HAVE_SCHED_GETAFFINITY=",
"HAVE_CPU_COUNT=",
"HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC=",
]
}
Expand Down

0 comments on commit 041a355

Please sign in to comment.