perf tools: Move everything related to sys_perf_event_open() to perf-sys.h
authorArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 29 Aug 2019 17:59:50 +0000 (14:59 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 29 Aug 2019 20:38:32 +0000 (17:38 -0300)
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>
23 files changed:
tools/perf/arch/common.c
tools/perf/arch/x86/tests/rdpmc.c
tools/perf/arch/x86/util/perf_regs.c
tools/perf/arch/x86/util/tsc.c
tools/perf/bench/epoll-ctl.c
tools/perf/bench/epoll-wait.c
tools/perf/bench/mem-functions.c
tools/perf/builtin-sched.c
tools/perf/perf-sys.h
tools/perf/perf.c
tools/perf/perf.h
tools/perf/tests/attr.c
tools/perf/tests/bp_account.c
tools/perf/tests/bp_signal.c
tools/perf/tests/bp_signal_overflow.c
tools/perf/tests/wp.c
tools/perf/util/auxtrace.h
tools/perf/util/cloexec.c
tools/perf/util/evsel.c
tools/perf/util/genelf.c
tools/perf/util/python.c
tools/perf/util/record.c
tools/perf/util/strbuf.c

index 1a9e22f78c229084151ab45be7b8c5957c1efeaf..a769382fb6449225822574e497da8efbc2962191 100644 (file)
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include "common.h"
 #include "../util/env.h"
 #include "../util/debug.h"
index 7a11f02d6c6c786e588552f70dcb8552aa585468..345a6a0a328b1174d29ce6df28c137a67c589dcc 100644 (file)
@@ -7,7 +7,7 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <linux/types.h>
-#include "perf.h"
+#include "perf-sys.h"
 #include "debug.h"
 #include "tests/tests.h"
 #include "cloexec.h"
index 0d7b77ff0ae693718272a3515958c6a55f4a74e1..74a606ea42d37b7f135e49aa8ee54d1a37f13243 100644 (file)
@@ -4,7 +4,7 @@
 #include <regex.h>
 #include <linux/zalloc.h>
 
-#include "../../perf.h"
+#include "../../perf-sys.h"
 #include "../../util/perf_regs.h"
 #include "../../util/debug.h"
 
index 81720e27f8a3464543ac31f3ccab614cb16efcab..a6ba45d0db6ea3e0ffe3a0ccb4c69e4a46b28248 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "../../../perf.h"
 #include <linux/types.h>
+#include <asm/barrier.h>
 #include "../../../util/debug.h"
 #include "../../../util/tsc.h"
 
index 84658d45f349e0475156d55ee99cecd838d9128f..d1caa4a0a12a46dbdcc57fc3a216c079763ce15d 100644 (file)
@@ -14,6 +14,7 @@
 #include <inttypes.h>
 #include <signal.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include <linux/compiler.h>
 #include <linux/kernel.h>
 #include <sys/time.h>
index c27a65639cfbf975bf02b39928c96bef6a46aec8..f6b4472847d2713f8ae6cdcb56db36cea2867bf0 100644 (file)
@@ -63,6 +63,7 @@
 /* For the CLR_() macros */
 #include <string.h>
 #include <pthread.h>
+#include <unistd.h>
 
 #include <errno.h>
 #include <inttypes.h>
index 64dc994c72ead60229490d1b883f667f1222075a..9235b76501be81c71bcdc9ee36bfd3f286a2a205 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include "debug.h"
-#include "../perf.h"
+#include "../perf-sys.h"
 #include <subcmd/parse-options.h>
 #include "../util/header.h"
 #include "../util/cloexec.h"
@@ -20,6 +20,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 #include <sys/time.h>
 #include <errno.h>
 #include <linux/time64.h>
index 025151dcb6518f3f1e73402b9da5a0f0d853a6ca..91d0a9b105811134a275323f4ea9f14b86604499 100644 (file)
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include "builtin.h"
 #include "perf.h"
+#include "perf-sys.h"
 
 #include "util/evlist.h"
 #include "util/cache.h"
index 6ffb0fbd62378218a7a3de26470479f433235246..63e4349a772adb540556285da1c89cb165a44e7c 100644 (file)
@@ -5,10 +5,17 @@
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/syscall.h>
-#include <linux/types.h>
 #include <linux/compiler.h>
-#include <linux/perf_event.h>
-#include <asm/barrier.h>
+
+struct perf_event_attr;
+
+extern bool test_attr__enabled;
+void test_attr__ready(void);
+void test_attr__init(void);
+void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
+                    int fd, int group_fd, unsigned long flags);
+
+#define HAVE_ATTR_TEST
 
 static inline int
 sys_perf_event_open(struct perf_event_attr *attr,
index 34763a9b873df756d4e31941c4c973d55754f3cf..a95a248a7421ac7e0899c348bae767993460793f 100644 (file)
@@ -19,6 +19,7 @@
 #include "util/debug.h"
 #include "util/event.h"
 #include "util/util.h"
+#include "perf-sys.h"
 #include <api/fs/fs.h>
 #include <api/fs/tracing_path.h>
 #include <errno.h>
index d9e6b8b957b64e27988a95f0d21372c763c08c9f..7a1a92127b9b65afcae81d696e9b8cee91f3cc98 100644 (file)
@@ -4,18 +4,6 @@
 
 #include <time.h>
 #include <stdbool.h>
-#include <linux/types.h>
-#include <linux/stddef.h>
-#include <linux/perf_event.h>
-
-extern bool test_attr__enabled;
-void test_attr__ready(void);
-void test_attr__init(void);
-void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
-                    int fd, int group_fd, unsigned long flags);
-
-#define HAVE_ATTR_TEST
-#include "perf-sys.h"
 
 static inline unsigned long long rdclock(void)
 {
index d8426547219b4cdea5e9b0cf24b974e7108b9045..87dc3e1174afe26d300e688a2d5febfba192eaec 100644 (file)
@@ -30,7 +30,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
-#include "../perf.h"
+#include "../perf-sys.h"
 #include <subcmd/exec-cmd.h>
 #include "tests.h"
 
index 153624e2d0f5e1bfa82f5b300a85783995f52937..c4a30318d7e0b25041e4f9c0e755ff82d779b274 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "tests.h"
 #include "debug.h"
-#include "perf.h"
+#include "../perf-sys.h"
 #include "cloexec.h"
 
 volatile long the_var;
index 910e25e64188316effdcf5382a4f024c1e09d63f..2d292f8fb3dd4f17c20b3e3239433af920283a47 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "tests.h"
 #include "debug.h"
-#include "perf.h"
+#include "perf-sys.h"
 #include "cloexec.h"
 
 static int fd1;
index ca962559e845e03081295e4659c75401a6431377..101315a3b34f25087324975b5efd7b7cfabcd99c 100644 (file)
@@ -24,7 +24,7 @@
 
 #include "tests.h"
 #include "debug.h"
-#include "perf.h"
+#include "../perf-sys.h"
 #include "cloexec.h"
 
 static int overflows;
index f89e6806557b2aa39ca56a6055cd88d948922722..982ac55d69ea165e7c69fecf0812dd0a1bcaa20e 100644 (file)
@@ -1,10 +1,12 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <stdlib.h>
+#include <unistd.h>
 #include <sys/ioctl.h>
 #include <linux/hw_breakpoint.h>
 #include "tests.h"
 #include "debug.h"
 #include "cloexec.h"
+#include "../perf-sys.h"
 
 #define WP_TEST_ASSERT_VAL(fd, text, val)       \
 do {                                            \
index b213e6431d886acdc44124610dfa77703c47383b..1fa8a965b03fdce7cdfa87e44b0e6ccb0868f84a 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/perf_event.h>
 #include <linux/types.h>
 #include <asm/bitsperlong.h>
+#include <asm/barrier.h>
 
 #include "../perf.h"
 #include "event.h"
index 06f48312c5ed05b76c11fae05c7a3c5f7851cc18..92d08198e64ad4d07ddb0c119fbbc657146113d2 100644 (file)
@@ -2,7 +2,7 @@
 #include <errno.h>
 #include <sched.h>
 #include "util.h"
-#include "../perf.h"
+#include "../perf-sys.h"
 #include "cloexec.h"
 #include "asm/bug.h"
 #include "debug.h"
index dbc04e1053a9b5091e5c6092eba9d25e25ddf24a..b6b406a1678ffb179aa63fcf3f0d80923d2b31f3 100644 (file)
@@ -41,6 +41,7 @@
 #include "string2.h"
 #include "memswap.h"
 #include "util.h"
+#include "../perf-sys.h"
 #include "util/parse-branch-options.h"
 #include <internal/xyarray.h>
 
index 7001247ebbd67a2e30d2d8d6501b4673ef998acb..bc32f405b26e3123c73e64f0d7901540c66a9861 100644 (file)
@@ -14,6 +14,7 @@
 #include <libelf.h>
 #include <string.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include <inttypes.h>
 #include <limits.h>
 #include <fcntl.h>
@@ -25,6 +26,7 @@
 #include "perf.h"
 #include "genelf.h"
 #include "../util/jitdump.h"
+#include <linux/compiler.h>
 
 #ifndef NT_GNU_BUILD_ID
 #define NT_GNU_BUILD_ID 3
index 11479a7ad1c7e6c24ccd4378bfe5a66036f44ff0..9dd83871aafe80c013d58261fb5a7fd01fc1495f 100644 (file)
@@ -14,6 +14,7 @@
 #include "thread_map.h"
 #include "mmap.h"
 #include "util.h"
+#include "../perf-sys.h"
 
 #if PY_MAJOR_VERSION < 3
 #define _PyUnicode_FromString(arg) \
index 574507d46c98905df81e46b361e19d8753120467..c67a51397bc737f2d91180272e6b2d94f92966b7 100644 (file)
@@ -10,6 +10,7 @@
 #include "util.h"
 #include "cloexec.h"
 #include "record.h"
+#include "../perf-sys.h"
 
 typedef void (*setup_probe_fn_t)(struct evsel *evsel);
 
index 2ce0dc887364ead68155a838969883ef74ab8053..0afdbf38a2b20c6a505dd1e0302cb2f1ff1eca56 100644 (file)
@@ -4,6 +4,7 @@
 #include <linux/zalloc.h>
 #include <errno.h>
 #include <stdlib.h>
+#include <unistd.h>
 
 /*
  * Used as the default ->buf value, so that people can always assume