Skip to content

Commit 041a355

Browse files
committed
[CMake] Delete HAVE_SCHED_GETAFFINITY and HAVE_CPU_COUNT
sched_getaffinity (Linux specific) has been available * in glibc since 2002-08-08 (commit 972e719e8154eec5f543b027e2a08dfa285d55d5) * in musl since the initial check-in.
1 parent a2eb55d commit 041a355

File tree

4 files changed

+2
-13
lines changed

4 files changed

+2
-13
lines changed

llvm/cmake/config-ix.cmake

-2
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,6 @@ if( LLVM_USING_GLIBC )
274274
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE")
275275
endif()
276276
# This check requires _GNU_SOURCE
277-
check_symbol_exists(sched_getaffinity sched.h HAVE_SCHED_GETAFFINITY)
278-
check_symbol_exists(CPU_COUNT sched.h HAVE_CPU_COUNT)
279277
if (NOT PURE_WINDOWS)
280278
if (LLVM_PTHREAD_LIB)
281279
list(APPEND CMAKE_REQUIRED_LIBRARIES ${LLVM_PTHREAD_LIB})

llvm/include/llvm/Config/config.h.cmake

-6
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,6 @@
160160
/* Define to 1 if you have the `setenv' function. */
161161
#cmakedefine HAVE_SETENV ${HAVE_SETENV}
162162

163-
/* Define to 1 if you have the `sched_getaffinity' function. */
164-
#cmakedefine HAVE_SCHED_GETAFFINITY ${HAVE_SCHED_GETAFFINITY}
165-
166-
/* Define to 1 if you have the `CPU_COUNT' macro. */
167-
#cmakedefine HAVE_CPU_COUNT ${HAVE_CPU_COUNT}
168-
169163
/* Define to 1 if you have the `setrlimit' function. */
170164
#cmakedefine HAVE_SETRLIMIT ${HAVE_SETRLIMIT}
171165

llvm/lib/Support/Unix/Threading.inc

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#endif
3939

4040
#if defined(__linux__)
41+
#include <sched.h> // For sched_getaffinity
4142
#include <sys/syscall.h> // For syscall codes
4243
#include <unistd.h> // For syscall()
4344
#endif
@@ -271,7 +272,7 @@ SetThreadPriorityResult llvm::set_thread_priority(ThreadPriority Priority) {
271272
#include <thread>
272273

273274
int computeHostNumHardwareThreads() {
274-
#if defined(HAVE_SCHED_GETAFFINITY) && defined(HAVE_CPU_COUNT)
275+
#ifdef __linux__
275276
cpu_set_t Set;
276277
if (sched_getaffinity(0, sizeof(Set), &Set) == 0)
277278
return CPU_COUNT(&Set);

llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn

-4
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,6 @@ write_cmake_config("config") {
141141
"HAVE_LSEEK64=1",
142142
"HAVE_MALLINFO=1",
143143
"HAVE_POSIX_FALLOCATE=1",
144-
"HAVE_SCHED_GETAFFINITY=1",
145-
"HAVE_CPU_COUNT=1",
146144
"HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC=1",
147145
]
148146
} else {
@@ -152,8 +150,6 @@ write_cmake_config("config") {
152150
"HAVE_LSEEK64=",
153151
"HAVE_MALLINFO=",
154152
"HAVE_POSIX_FALLOCATE=",
155-
"HAVE_SCHED_GETAFFINITY=",
156-
"HAVE_CPU_COUNT=",
157153
"HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC=",
158154
]
159155
}

0 commit comments

Comments
 (0)