summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/build/Makefile.feature1
-rw-r--r--tools/build/feature/Makefile6
-rw-r--r--tools/build/feature/test-all.c5
-rw-r--r--tools/build/feature/test-sched_getcpu.c7
-rw-r--r--tools/perf/Makefile.config4
-rw-r--r--tools/perf/util/cloexec.h6
-rw-r--r--tools/perf/util/util.h4
7 files changed, 24 insertions, 9 deletions
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index e3fb5ecbdcb6..523911f316ce 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -63,6 +63,7 @@ FEATURE_TESTS_BASIC := \
63 lzma \ 63 lzma \
64 get_cpuid \ 64 get_cpuid \
65 bpf \ 65 bpf \
66 sched_getcpu \
66 sdt 67 sdt
67 68
68# FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list 69# FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index b564a2eea039..ab1e2bbc2e96 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -48,7 +48,8 @@ FILES= \
48 test-get_cpuid.bin \ 48 test-get_cpuid.bin \
49 test-sdt.bin \ 49 test-sdt.bin \
50 test-cxx.bin \ 50 test-cxx.bin \
51 test-jvmti.bin 51 test-jvmti.bin \
52 test-sched_getcpu.bin
52 53
53FILES := $(addprefix $(OUTPUT),$(FILES)) 54FILES := $(addprefix $(OUTPUT),$(FILES))
54 55
@@ -91,6 +92,9 @@ $(OUTPUT)test-libelf.bin:
91$(OUTPUT)test-glibc.bin: 92$(OUTPUT)test-glibc.bin:
92 $(BUILD) 93 $(BUILD)
93 94
95$(OUTPUT)test-sched_getcpu.bin:
96 $(BUILD)
97
94DWARFLIBS := -ldw 98DWARFLIBS := -ldw
95ifeq ($(findstring -static,${LDFLAGS}),-static) 99ifeq ($(findstring -static,${LDFLAGS}),-static)
96DWARFLIBS += -lelf -lebl -lz -llzma -lbz2 100DWARFLIBS += -lelf -lebl -lz -llzma -lbz2
diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
index 699e43627397..cc6c7c01f4ca 100644
--- a/tools/build/feature/test-all.c
+++ b/tools/build/feature/test-all.c
@@ -117,6 +117,10 @@
117# include "test-pthread-attr-setaffinity-np.c" 117# include "test-pthread-attr-setaffinity-np.c"
118#undef main 118#undef main
119 119
120#define main main_test_sched_getcpu
121# include "test-sched_getcpu.c"
122#undef main
123
120# if 0 124# if 0
121/* 125/*
122 * Disable libbabeltrace check for test-all, because the requested 126 * Disable libbabeltrace check for test-all, because the requested
@@ -182,6 +186,7 @@ int main(int argc, char *argv[])
182 main_test_get_cpuid(); 186 main_test_get_cpuid();
183 main_test_bpf(); 187 main_test_bpf();
184 main_test_libcrypto(); 188 main_test_libcrypto();
189 main_test_sched_getcpu();
185 main_test_sdt(); 190 main_test_sdt();
186 191
187 return 0; 192 return 0;
diff --git a/tools/build/feature/test-sched_getcpu.c b/tools/build/feature/test-sched_getcpu.c
new file mode 100644
index 000000000000..c4a148dd7104
--- /dev/null
+++ b/tools/build/feature/test-sched_getcpu.c
@@ -0,0 +1,7 @@
1#define _GNU_SOURCE
2#include <sched.h>
3
4int main(void)
5{
6 return sched_getcpu();
7}
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 27c9fbca7bd9..2b656de99495 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -317,6 +317,10 @@ ifdef NO_DWARF
317 NO_LIBDW_DWARF_UNWIND := 1 317 NO_LIBDW_DWARF_UNWIND := 1
318endif 318endif
319 319
320ifeq ($(feature-sched_getcpu), 1)
321 CFLAGS += -DHAVE_SCHED_GETCPU_SUPPORT
322endif
323
320ifndef NO_LIBELF 324ifndef NO_LIBELF
321 CFLAGS += -DHAVE_LIBELF_SUPPORT 325 CFLAGS += -DHAVE_LIBELF_SUPPORT
322 EXTLIBS += -lelf 326 EXTLIBS += -lelf
diff --git a/tools/perf/util/cloexec.h b/tools/perf/util/cloexec.h
index d0d465953d36..94a5a7d829d5 100644
--- a/tools/perf/util/cloexec.h
+++ b/tools/perf/util/cloexec.h
@@ -3,10 +3,4 @@
3 3
4unsigned long perf_event_open_cloexec_flag(void); 4unsigned long perf_event_open_cloexec_flag(void);
5 5
6#ifdef __GLIBC_PREREQ
7#if !__GLIBC_PREREQ(2, 6) && !defined(__UCLIBC__)
8int sched_getcpu(void) __THROW;
9#endif
10#endif
11
12#endif /* __PERF_CLOEXEC_H */ 6#endif /* __PERF_CLOEXEC_H */
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index c74708da8571..b2cfa47990dc 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -355,8 +355,8 @@ void print_binary(unsigned char *data, size_t len,
355 size_t bytes_per_line, print_binary_t printer, 355 size_t bytes_per_line, print_binary_t printer,
356 void *extra); 356 void *extra);
357 357
358#if !defined(__GLIBC__) && !defined(__ANDROID__) 358#ifndef HAVE_SCHED_GETCPU_SUPPORT
359extern int sched_getcpu(void); 359int sched_getcpu(void);
360#endif 360#endif
361 361
362int is_printable_array(char *p, unsigned int len); 362int is_printable_array(char *p, unsigned int len);