diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/build/Makefile.feature | 1 | ||||
-rw-r--r-- | tools/build/feature/Makefile | 4 | ||||
-rw-r--r-- | tools/build/feature/test-all.c | 5 | ||||
-rw-r--r-- | tools/build/feature/test-gettid.c | 11 | ||||
-rw-r--r-- | tools/perf/Makefile.config | 4 | ||||
-rw-r--r-- | tools/perf/jvmti/jvmti_agent.c | 2 |
6 files changed, 27 insertions, 0 deletions
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature index 3b24231c58a2..50377cc2f5f9 100644 --- a/tools/build/Makefile.feature +++ b/tools/build/Makefile.feature | |||
@@ -36,6 +36,7 @@ FEATURE_TESTS_BASIC := \ | |||
36 | fortify-source \ | 36 | fortify-source \ |
37 | sync-compare-and-swap \ | 37 | sync-compare-and-swap \ |
38 | get_current_dir_name \ | 38 | get_current_dir_name \ |
39 | gettid \ | ||
39 | glibc \ | 40 | glibc \ |
40 | gtk2 \ | 41 | gtk2 \ |
41 | gtk2-infobar \ | 42 | gtk2-infobar \ |
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index 4b8244ee65ce..523ee42db0c8 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile | |||
@@ -54,6 +54,7 @@ FILES= \ | |||
54 | test-get_cpuid.bin \ | 54 | test-get_cpuid.bin \ |
55 | test-sdt.bin \ | 55 | test-sdt.bin \ |
56 | test-cxx.bin \ | 56 | test-cxx.bin \ |
57 | test-gettid.bin \ | ||
57 | test-jvmti.bin \ | 58 | test-jvmti.bin \ |
58 | test-jvmti-cmlr.bin \ | 59 | test-jvmti-cmlr.bin \ |
59 | test-sched_getcpu.bin \ | 60 | test-sched_getcpu.bin \ |
@@ -267,6 +268,9 @@ $(OUTPUT)test-sdt.bin: | |||
267 | $(OUTPUT)test-cxx.bin: | 268 | $(OUTPUT)test-cxx.bin: |
268 | $(BUILDXX) -std=gnu++11 | 269 | $(BUILDXX) -std=gnu++11 |
269 | 270 | ||
271 | $(OUTPUT)test-gettid.bin: | ||
272 | $(BUILD) | ||
273 | |||
270 | $(OUTPUT)test-jvmti.bin: | 274 | $(OUTPUT)test-jvmti.bin: |
271 | $(BUILD) | 275 | $(BUILD) |
272 | 276 | ||
diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c index a59c53705093..3b3d5d72124a 100644 --- a/tools/build/feature/test-all.c +++ b/tools/build/feature/test-all.c | |||
@@ -38,6 +38,10 @@ | |||
38 | # include "test-get_current_dir_name.c" | 38 | # include "test-get_current_dir_name.c" |
39 | #undef main | 39 | #undef main |
40 | 40 | ||
41 | #define main main_test_gettid | ||
42 | # include "test-gettid.c" | ||
43 | #undef main | ||
44 | |||
41 | #define main main_test_glibc | 45 | #define main main_test_glibc |
42 | # include "test-glibc.c" | 46 | # include "test-glibc.c" |
43 | #undef main | 47 | #undef main |
@@ -195,6 +199,7 @@ int main(int argc, char *argv[]) | |||
195 | main_test_libelf(); | 199 | main_test_libelf(); |
196 | main_test_libelf_mmap(); | 200 | main_test_libelf_mmap(); |
197 | main_test_get_current_dir_name(); | 201 | main_test_get_current_dir_name(); |
202 | main_test_gettid(); | ||
198 | main_test_glibc(); | 203 | main_test_glibc(); |
199 | main_test_dwarf(); | 204 | main_test_dwarf(); |
200 | main_test_dwarf_getlocations(); | 205 | main_test_dwarf_getlocations(); |
diff --git a/tools/build/feature/test-gettid.c b/tools/build/feature/test-gettid.c new file mode 100644 index 000000000000..ef24e42d3f1b --- /dev/null +++ b/tools/build/feature/test-gettid.c | |||
@@ -0,0 +1,11 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
2 | // Copyright (C) 2019, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com> | ||
3 | #define _GNU_SOURCE | ||
4 | #include <unistd.h> | ||
5 | |||
6 | int main(void) | ||
7 | { | ||
8 | return gettid(); | ||
9 | } | ||
10 | |||
11 | #undef _GNU_SOURCE | ||
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 85fbcd265351..a6251e622c7e 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config | |||
@@ -332,6 +332,10 @@ ifeq ($(feature-get_current_dir_name), 1) | |||
332 | CFLAGS += -DHAVE_GET_CURRENT_DIR_NAME | 332 | CFLAGS += -DHAVE_GET_CURRENT_DIR_NAME |
333 | endif | 333 | endif |
334 | 334 | ||
335 | ifeq ($(feature-gettid), 1) | ||
336 | CFLAGS += -DHAVE_GETTID | ||
337 | endif | ||
338 | |||
335 | ifdef NO_LIBELF | 339 | ifdef NO_LIBELF |
336 | NO_DWARF := 1 | 340 | NO_DWARF := 1 |
337 | NO_DEMANGLE := 1 | 341 | NO_DEMANGLE := 1 |
diff --git a/tools/perf/jvmti/jvmti_agent.c b/tools/perf/jvmti/jvmti_agent.c index f7eb63cbbc65..88108598d6e9 100644 --- a/tools/perf/jvmti/jvmti_agent.c +++ b/tools/perf/jvmti/jvmti_agent.c | |||
@@ -45,10 +45,12 @@ | |||
45 | static char jit_path[PATH_MAX]; | 45 | static char jit_path[PATH_MAX]; |
46 | static void *marker_addr; | 46 | static void *marker_addr; |
47 | 47 | ||
48 | #ifndef HAVE_GETTID | ||
48 | static inline pid_t gettid(void) | 49 | static inline pid_t gettid(void) |
49 | { | 50 | { |
50 | return (pid_t)syscall(__NR_gettid); | 51 | return (pid_t)syscall(__NR_gettid); |
51 | } | 52 | } |
53 | #endif | ||
52 | 54 | ||
53 | static int get_e_machine(struct jitheader *hdr) | 55 | static int get_e_machine(struct jitheader *hdr) |
54 | { | 56 | { |