diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-08-29 13:59:50 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-08-29 16:38:32 -0400 |
commit | 91854f9a077e18e43ed30ebe9c61f8089bec9166 (patch) | |
tree | becf4f07f651257a1e5cc36f2d2408bc6c4e9965 | |
parent | a77494026309711a5f1e4b078e353cd46c2dad9f (diff) |
perf tools: Move everything related to sys_perf_event_open() to perf-sys.h
And remove unneeded include directives from perf-sys.h to prune the
header dependency tree.
Fixup the fallout in places where definitions were being used without
the needed include directives that were being satisfied because they
were in perf-sys.h.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-7b1zvugiwak4ibfa3j6ott7f@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/arch/common.c | 1 | ||||
-rw-r--r-- | tools/perf/arch/x86/tests/rdpmc.c | 2 | ||||
-rw-r--r-- | tools/perf/arch/x86/util/perf_regs.c | 2 | ||||
-rw-r--r-- | tools/perf/arch/x86/util/tsc.c | 1 | ||||
-rw-r--r-- | tools/perf/bench/epoll-ctl.c | 1 | ||||
-rw-r--r-- | tools/perf/bench/epoll-wait.c | 1 | ||||
-rw-r--r-- | tools/perf/bench/mem-functions.c | 3 | ||||
-rw-r--r-- | tools/perf/builtin-sched.c | 1 | ||||
-rw-r--r-- | tools/perf/perf-sys.h | 13 | ||||
-rw-r--r-- | tools/perf/perf.c | 1 | ||||
-rw-r--r-- | tools/perf/perf.h | 12 | ||||
-rw-r--r-- | tools/perf/tests/attr.c | 2 | ||||
-rw-r--r-- | tools/perf/tests/bp_account.c | 2 | ||||
-rw-r--r-- | tools/perf/tests/bp_signal.c | 2 | ||||
-rw-r--r-- | tools/perf/tests/bp_signal_overflow.c | 2 | ||||
-rw-r--r-- | tools/perf/tests/wp.c | 2 | ||||
-rw-r--r-- | tools/perf/util/auxtrace.h | 1 | ||||
-rw-r--r-- | tools/perf/util/cloexec.c | 2 | ||||
-rw-r--r-- | tools/perf/util/evsel.c | 1 | ||||
-rw-r--r-- | tools/perf/util/genelf.c | 2 | ||||
-rw-r--r-- | tools/perf/util/python.c | 1 | ||||
-rw-r--r-- | tools/perf/util/record.c | 1 | ||||
-rw-r--r-- | tools/perf/util/strbuf.c | 1 |
23 files changed, 34 insertions, 23 deletions
diff --git a/tools/perf/arch/common.c b/tools/perf/arch/common.c index 1a9e22f78c22..a769382fb644 100644 --- a/tools/perf/arch/common.c +++ b/tools/perf/arch/common.c | |||
@@ -1,6 +1,7 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
2 | #include <stdio.h> | 2 | #include <stdio.h> |
3 | #include <stdlib.h> | 3 | #include <stdlib.h> |
4 | #include <unistd.h> | ||
4 | #include "common.h" | 5 | #include "common.h" |
5 | #include "../util/env.h" | 6 | #include "../util/env.h" |
6 | #include "../util/debug.h" | 7 | #include "../util/debug.h" |
diff --git a/tools/perf/arch/x86/tests/rdpmc.c b/tools/perf/arch/x86/tests/rdpmc.c index 7a11f02d6c6c..345a6a0a328b 100644 --- a/tools/perf/arch/x86/tests/rdpmc.c +++ b/tools/perf/arch/x86/tests/rdpmc.c | |||
@@ -7,7 +7,7 @@ | |||
7 | #include <sys/types.h> | 7 | #include <sys/types.h> |
8 | #include <sys/wait.h> | 8 | #include <sys/wait.h> |
9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
10 | #include "perf.h" | 10 | #include "perf-sys.h" |
11 | #include "debug.h" | 11 | #include "debug.h" |
12 | #include "tests/tests.h" | 12 | #include "tests/tests.h" |
13 | #include "cloexec.h" | 13 | #include "cloexec.h" |
diff --git a/tools/perf/arch/x86/util/perf_regs.c b/tools/perf/arch/x86/util/perf_regs.c index 0d7b77ff0ae6..74a606ea42d3 100644 --- a/tools/perf/arch/x86/util/perf_regs.c +++ b/tools/perf/arch/x86/util/perf_regs.c | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <regex.h> | 4 | #include <regex.h> |
5 | #include <linux/zalloc.h> | 5 | #include <linux/zalloc.h> |
6 | 6 | ||
7 | #include "../../perf.h" | 7 | #include "../../perf-sys.h" |
8 | #include "../../util/perf_regs.h" | 8 | #include "../../util/perf_regs.h" |
9 | #include "../../util/debug.h" | 9 | #include "../../util/debug.h" |
10 | 10 | ||
diff --git a/tools/perf/arch/x86/util/tsc.c b/tools/perf/arch/x86/util/tsc.c index 81720e27f8a3..a6ba45d0db6e 100644 --- a/tools/perf/arch/x86/util/tsc.c +++ b/tools/perf/arch/x86/util/tsc.c | |||
@@ -7,6 +7,7 @@ | |||
7 | 7 | ||
8 | #include "../../../perf.h" | 8 | #include "../../../perf.h" |
9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
10 | #include <asm/barrier.h> | ||
10 | #include "../../../util/debug.h" | 11 | #include "../../../util/debug.h" |
11 | #include "../../../util/tsc.h" | 12 | #include "../../../util/tsc.h" |
12 | 13 | ||
diff --git a/tools/perf/bench/epoll-ctl.c b/tools/perf/bench/epoll-ctl.c index 84658d45f349..d1caa4a0a12a 100644 --- a/tools/perf/bench/epoll-ctl.c +++ b/tools/perf/bench/epoll-ctl.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <inttypes.h> | 14 | #include <inttypes.h> |
15 | #include <signal.h> | 15 | #include <signal.h> |
16 | #include <stdlib.h> | 16 | #include <stdlib.h> |
17 | #include <unistd.h> | ||
17 | #include <linux/compiler.h> | 18 | #include <linux/compiler.h> |
18 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
19 | #include <sys/time.h> | 20 | #include <sys/time.h> |
diff --git a/tools/perf/bench/epoll-wait.c b/tools/perf/bench/epoll-wait.c index c27a65639cfb..f6b4472847d2 100644 --- a/tools/perf/bench/epoll-wait.c +++ b/tools/perf/bench/epoll-wait.c | |||
@@ -63,6 +63,7 @@ | |||
63 | /* For the CLR_() macros */ | 63 | /* For the CLR_() macros */ |
64 | #include <string.h> | 64 | #include <string.h> |
65 | #include <pthread.h> | 65 | #include <pthread.h> |
66 | #include <unistd.h> | ||
66 | 67 | ||
67 | #include <errno.h> | 68 | #include <errno.h> |
68 | #include <inttypes.h> | 69 | #include <inttypes.h> |
diff --git a/tools/perf/bench/mem-functions.c b/tools/perf/bench/mem-functions.c index 64dc994c72ea..9235b76501be 100644 --- a/tools/perf/bench/mem-functions.c +++ b/tools/perf/bench/mem-functions.c | |||
@@ -8,7 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include "debug.h" | 10 | #include "debug.h" |
11 | #include "../perf.h" | 11 | #include "../perf-sys.h" |
12 | #include <subcmd/parse-options.h> | 12 | #include <subcmd/parse-options.h> |
13 | #include "../util/header.h" | 13 | #include "../util/header.h" |
14 | #include "../util/cloexec.h" | 14 | #include "../util/cloexec.h" |
@@ -20,6 +20,7 @@ | |||
20 | #include <stdio.h> | 20 | #include <stdio.h> |
21 | #include <stdlib.h> | 21 | #include <stdlib.h> |
22 | #include <string.h> | 22 | #include <string.h> |
23 | #include <unistd.h> | ||
23 | #include <sys/time.h> | 24 | #include <sys/time.h> |
24 | #include <errno.h> | 25 | #include <errno.h> |
25 | #include <linux/time64.h> | 26 | #include <linux/time64.h> |
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 025151dcb651..91d0a9b10581 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -1,6 +1,7 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
2 | #include "builtin.h" | 2 | #include "builtin.h" |
3 | #include "perf.h" | 3 | #include "perf.h" |
4 | #include "perf-sys.h" | ||
4 | 5 | ||
5 | #include "util/evlist.h" | 6 | #include "util/evlist.h" |
6 | #include "util/cache.h" | 7 | #include "util/cache.h" |
diff --git a/tools/perf/perf-sys.h b/tools/perf/perf-sys.h index 6ffb0fbd6237..63e4349a772a 100644 --- a/tools/perf/perf-sys.h +++ b/tools/perf/perf-sys.h | |||
@@ -5,10 +5,17 @@ | |||
5 | #include <unistd.h> | 5 | #include <unistd.h> |
6 | #include <sys/types.h> | 6 | #include <sys/types.h> |
7 | #include <sys/syscall.h> | 7 | #include <sys/syscall.h> |
8 | #include <linux/types.h> | ||
9 | #include <linux/compiler.h> | 8 | #include <linux/compiler.h> |
10 | #include <linux/perf_event.h> | 9 | |
11 | #include <asm/barrier.h> | 10 | struct perf_event_attr; |
11 | |||
12 | extern bool test_attr__enabled; | ||
13 | void test_attr__ready(void); | ||
14 | void test_attr__init(void); | ||
15 | void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu, | ||
16 | int fd, int group_fd, unsigned long flags); | ||
17 | |||
18 | #define HAVE_ATTR_TEST | ||
12 | 19 | ||
13 | static inline int | 20 | static inline int |
14 | sys_perf_event_open(struct perf_event_attr *attr, | 21 | sys_perf_event_open(struct perf_event_attr *attr, |
diff --git a/tools/perf/perf.c b/tools/perf/perf.c index 34763a9b873d..a95a248a7421 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include "util/debug.h" | 19 | #include "util/debug.h" |
20 | #include "util/event.h" | 20 | #include "util/event.h" |
21 | #include "util/util.h" | 21 | #include "util/util.h" |
22 | #include "perf-sys.h" | ||
22 | #include <api/fs/fs.h> | 23 | #include <api/fs/fs.h> |
23 | #include <api/fs/tracing_path.h> | 24 | #include <api/fs/tracing_path.h> |
24 | #include <errno.h> | 25 | #include <errno.h> |
diff --git a/tools/perf/perf.h b/tools/perf/perf.h index d9e6b8b957b6..7a1a92127b9b 100644 --- a/tools/perf/perf.h +++ b/tools/perf/perf.h | |||
@@ -4,18 +4,6 @@ | |||
4 | 4 | ||
5 | #include <time.h> | 5 | #include <time.h> |
6 | #include <stdbool.h> | 6 | #include <stdbool.h> |
7 | #include <linux/types.h> | ||
8 | #include <linux/stddef.h> | ||
9 | #include <linux/perf_event.h> | ||
10 | |||
11 | extern bool test_attr__enabled; | ||
12 | void test_attr__ready(void); | ||
13 | void test_attr__init(void); | ||
14 | void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu, | ||
15 | int fd, int group_fd, unsigned long flags); | ||
16 | |||
17 | #define HAVE_ATTR_TEST | ||
18 | #include "perf-sys.h" | ||
19 | 7 | ||
20 | static inline unsigned long long rdclock(void) | 8 | static inline unsigned long long rdclock(void) |
21 | { | 9 | { |
diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c index d8426547219b..87dc3e1174af 100644 --- a/tools/perf/tests/attr.c +++ b/tools/perf/tests/attr.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <sys/types.h> | 30 | #include <sys/types.h> |
31 | #include <sys/stat.h> | 31 | #include <sys/stat.h> |
32 | #include <unistd.h> | 32 | #include <unistd.h> |
33 | #include "../perf.h" | 33 | #include "../perf-sys.h" |
34 | #include <subcmd/exec-cmd.h> | 34 | #include <subcmd/exec-cmd.h> |
35 | #include "tests.h" | 35 | #include "tests.h" |
36 | 36 | ||
diff --git a/tools/perf/tests/bp_account.c b/tools/perf/tests/bp_account.c index 153624e2d0f5..c4a30318d7e0 100644 --- a/tools/perf/tests/bp_account.c +++ b/tools/perf/tests/bp_account.c | |||
@@ -19,7 +19,7 @@ | |||
19 | 19 | ||
20 | #include "tests.h" | 20 | #include "tests.h" |
21 | #include "debug.h" | 21 | #include "debug.h" |
22 | #include "perf.h" | 22 | #include "../perf-sys.h" |
23 | #include "cloexec.h" | 23 | #include "cloexec.h" |
24 | 24 | ||
25 | volatile long the_var; | 25 | volatile long the_var; |
diff --git a/tools/perf/tests/bp_signal.c b/tools/perf/tests/bp_signal.c index 910e25e64188..2d292f8fb3dd 100644 --- a/tools/perf/tests/bp_signal.c +++ b/tools/perf/tests/bp_signal.c | |||
@@ -25,7 +25,7 @@ | |||
25 | 25 | ||
26 | #include "tests.h" | 26 | #include "tests.h" |
27 | #include "debug.h" | 27 | #include "debug.h" |
28 | #include "perf.h" | 28 | #include "perf-sys.h" |
29 | #include "cloexec.h" | 29 | #include "cloexec.h" |
30 | 30 | ||
31 | static int fd1; | 31 | static int fd1; |
diff --git a/tools/perf/tests/bp_signal_overflow.c b/tools/perf/tests/bp_signal_overflow.c index ca962559e845..101315a3b34f 100644 --- a/tools/perf/tests/bp_signal_overflow.c +++ b/tools/perf/tests/bp_signal_overflow.c | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | #include "tests.h" | 25 | #include "tests.h" |
26 | #include "debug.h" | 26 | #include "debug.h" |
27 | #include "perf.h" | 27 | #include "../perf-sys.h" |
28 | #include "cloexec.h" | 28 | #include "cloexec.h" |
29 | 29 | ||
30 | static int overflows; | 30 | static int overflows; |
diff --git a/tools/perf/tests/wp.c b/tools/perf/tests/wp.c index f89e6806557b..982ac55d69ea 100644 --- a/tools/perf/tests/wp.c +++ b/tools/perf/tests/wp.c | |||
@@ -1,10 +1,12 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | #include <unistd.h> | ||
3 | #include <sys/ioctl.h> | 4 | #include <sys/ioctl.h> |
4 | #include <linux/hw_breakpoint.h> | 5 | #include <linux/hw_breakpoint.h> |
5 | #include "tests.h" | 6 | #include "tests.h" |
6 | #include "debug.h" | 7 | #include "debug.h" |
7 | #include "cloexec.h" | 8 | #include "cloexec.h" |
9 | #include "../perf-sys.h" | ||
8 | 10 | ||
9 | #define WP_TEST_ASSERT_VAL(fd, text, val) \ | 11 | #define WP_TEST_ASSERT_VAL(fd, text, val) \ |
10 | do { \ | 12 | do { \ |
diff --git a/tools/perf/util/auxtrace.h b/tools/perf/util/auxtrace.h index b213e6431d88..1fa8a965b03f 100644 --- a/tools/perf/util/auxtrace.h +++ b/tools/perf/util/auxtrace.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/perf_event.h> | 15 | #include <linux/perf_event.h> |
16 | #include <linux/types.h> | 16 | #include <linux/types.h> |
17 | #include <asm/bitsperlong.h> | 17 | #include <asm/bitsperlong.h> |
18 | #include <asm/barrier.h> | ||
18 | 19 | ||
19 | #include "../perf.h" | 20 | #include "../perf.h" |
20 | #include "event.h" | 21 | #include "event.h" |
diff --git a/tools/perf/util/cloexec.c b/tools/perf/util/cloexec.c index 06f48312c5ed..92d08198e64a 100644 --- a/tools/perf/util/cloexec.c +++ b/tools/perf/util/cloexec.c | |||
@@ -2,7 +2,7 @@ | |||
2 | #include <errno.h> | 2 | #include <errno.h> |
3 | #include <sched.h> | 3 | #include <sched.h> |
4 | #include "util.h" | 4 | #include "util.h" |
5 | #include "../perf.h" | 5 | #include "../perf-sys.h" |
6 | #include "cloexec.h" | 6 | #include "cloexec.h" |
7 | #include "asm/bug.h" | 7 | #include "asm/bug.h" |
8 | #include "debug.h" | 8 | #include "debug.h" |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index dbc04e1053a9..b6b406a1678f 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include "string2.h" | 41 | #include "string2.h" |
42 | #include "memswap.h" | 42 | #include "memswap.h" |
43 | #include "util.h" | 43 | #include "util.h" |
44 | #include "../perf-sys.h" | ||
44 | #include "util/parse-branch-options.h" | 45 | #include "util/parse-branch-options.h" |
45 | #include <internal/xyarray.h> | 46 | #include <internal/xyarray.h> |
46 | 47 | ||
diff --git a/tools/perf/util/genelf.c b/tools/perf/util/genelf.c index 7001247ebbd6..bc32f405b26e 100644 --- a/tools/perf/util/genelf.c +++ b/tools/perf/util/genelf.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <libelf.h> | 14 | #include <libelf.h> |
15 | #include <string.h> | 15 | #include <string.h> |
16 | #include <stdlib.h> | 16 | #include <stdlib.h> |
17 | #include <unistd.h> | ||
17 | #include <inttypes.h> | 18 | #include <inttypes.h> |
18 | #include <limits.h> | 19 | #include <limits.h> |
19 | #include <fcntl.h> | 20 | #include <fcntl.h> |
@@ -25,6 +26,7 @@ | |||
25 | #include "perf.h" | 26 | #include "perf.h" |
26 | #include "genelf.h" | 27 | #include "genelf.h" |
27 | #include "../util/jitdump.h" | 28 | #include "../util/jitdump.h" |
29 | #include <linux/compiler.h> | ||
28 | 30 | ||
29 | #ifndef NT_GNU_BUILD_ID | 31 | #ifndef NT_GNU_BUILD_ID |
30 | #define NT_GNU_BUILD_ID 3 | 32 | #define NT_GNU_BUILD_ID 3 |
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index 11479a7ad1c7..9dd83871aafe 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include "thread_map.h" | 14 | #include "thread_map.h" |
15 | #include "mmap.h" | 15 | #include "mmap.h" |
16 | #include "util.h" | 16 | #include "util.h" |
17 | #include "../perf-sys.h" | ||
17 | 18 | ||
18 | #if PY_MAJOR_VERSION < 3 | 19 | #if PY_MAJOR_VERSION < 3 |
19 | #define _PyUnicode_FromString(arg) \ | 20 | #define _PyUnicode_FromString(arg) \ |
diff --git a/tools/perf/util/record.c b/tools/perf/util/record.c index 574507d46c98..c67a51397bc7 100644 --- a/tools/perf/util/record.c +++ b/tools/perf/util/record.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include "util.h" | 10 | #include "util.h" |
11 | #include "cloexec.h" | 11 | #include "cloexec.h" |
12 | #include "record.h" | 12 | #include "record.h" |
13 | #include "../perf-sys.h" | ||
13 | 14 | ||
14 | typedef void (*setup_probe_fn_t)(struct evsel *evsel); | 15 | typedef void (*setup_probe_fn_t)(struct evsel *evsel); |
15 | 16 | ||
diff --git a/tools/perf/util/strbuf.c b/tools/perf/util/strbuf.c index 2ce0dc887364..0afdbf38a2b2 100644 --- a/tools/perf/util/strbuf.c +++ b/tools/perf/util/strbuf.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/zalloc.h> | 4 | #include <linux/zalloc.h> |
5 | #include <errno.h> | 5 | #include <errno.h> |
6 | #include <stdlib.h> | 6 | #include <stdlib.h> |
7 | #include <unistd.h> | ||
7 | 8 | ||
8 | /* | 9 | /* |
9 | * Used as the default ->buf value, so that people can always assume | 10 | * Used as the default ->buf value, so that people can always assume |