summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2017-04-18 09:46:11 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2017-04-19 12:01:51 -0400
commita43783aeec5fac8ef372ff8c0a5bbb3056fc0604 (patch)
treeb8c8f9f929543f1768c8a103636a38746e2bd6df
parenta067558e2fa72445e8f6e6b2dd372a82afae6e49 (diff)
perf tools: Include errno.h where needed
Removing it from util.h, part of an effort to disentangle the includes hell, that makes changes to util.h or something included by it to cause a complete rebuild of the tools. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/n/tip-ztrjy52q1rqcchuy3rubfgt2@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/arch/arm64/util/dwarf-regs.c1
-rw-r--r--tools/perf/arch/powerpc/util/kvm-stat.c1
-rw-r--r--tools/perf/arch/powerpc/util/perf_regs.c1
-rw-r--r--tools/perf/arch/s390/util/kvm-stat.c1
-rw-r--r--tools/perf/arch/x86/tests/intel-cqm.c1
-rw-r--r--tools/perf/arch/x86/tests/perf-time-to-tsc.c1
-rw-r--r--tools/perf/arch/x86/util/auxtrace.c1
-rw-r--r--tools/perf/arch/x86/util/intel-bts.c1
-rw-r--r--tools/perf/arch/x86/util/intel-pt.c1
-rw-r--r--tools/perf/arch/x86/util/kvm-stat.c1
-rw-r--r--tools/perf/arch/x86/util/perf_regs.c1
-rw-r--r--tools/perf/builtin-annotate.c1
-rw-r--r--tools/perf/builtin-buildid-cache.c1
-rw-r--r--tools/perf/builtin-buildid-list.c1
-rw-r--r--tools/perf/builtin-c2c.c1
-rw-r--r--tools/perf/builtin-diff.c1
-rw-r--r--tools/perf/builtin-ftrace.c1
-rw-r--r--tools/perf/builtin-help.c1
-rw-r--r--tools/perf/builtin-inject.c1
-rw-r--r--tools/perf/builtin-kmem.c1
-rw-r--r--tools/perf/builtin-kvm.c1
-rw-r--r--tools/perf/builtin-lock.c1
-rw-r--r--tools/perf/builtin-record.c1
-rw-r--r--tools/perf/builtin-report.c1
-rw-r--r--tools/perf/builtin-sched.c1
-rw-r--r--tools/perf/builtin-script.c1
-rw-r--r--tools/perf/builtin-stat.c1
-rw-r--r--tools/perf/builtin-timechart.c1
-rw-r--r--tools/perf/builtin-trace.c1
-rw-r--r--tools/perf/perf.c1
-rw-r--r--tools/perf/tests/attr.c1
-rw-r--r--tools/perf/tests/backward-ring-buffer.c1
-rw-r--r--tools/perf/tests/bpf.c1
-rw-r--r--tools/perf/tests/builtin-test.c1
-rw-r--r--tools/perf/tests/code-reading.c1
-rw-r--r--tools/perf/tests/event-times.c1
-rw-r--r--tools/perf/tests/evsel-roundtrip-name.c1
-rw-r--r--tools/perf/tests/hists_link.c1
-rw-r--r--tools/perf/tests/mmap-basic.c1
-rw-r--r--tools/perf/tests/openat-syscall-all-cpus.c1
-rw-r--r--tools/perf/tests/openat-syscall-tp-fields.c1
-rw-r--r--tools/perf/tests/openat-syscall.c1
-rw-r--r--tools/perf/tests/parse-events.c1
-rw-r--r--tools/perf/tests/perf-record.c1
-rw-r--r--tools/perf/tests/pmu.c1
-rw-r--r--tools/perf/tests/sdt.c1
-rw-r--r--tools/perf/tests/sw-clock.c1
-rw-r--r--tools/perf/tests/switch-tracking.c1
-rw-r--r--tools/perf/tests/task-exit.c1
-rw-r--r--tools/perf/ui/browsers/hists.c1
-rw-r--r--tools/perf/util/annotate.c1
-rw-r--r--tools/perf/util/auxtrace.h1
-rw-r--r--tools/perf/util/bpf-loader.c1
-rw-r--r--tools/perf/util/bpf-loader.h2
-rw-r--r--tools/perf/util/bpf-prologue.c1
-rw-r--r--tools/perf/util/bpf-prologue.h2
-rw-r--r--tools/perf/util/build-id.c1
-rw-r--r--tools/perf/util/c++/clang-c.h1
-rw-r--r--tools/perf/util/cloexec.c1
-rw-r--r--tools/perf/util/comm.c1
-rw-r--r--tools/perf/util/config.c1
-rw-r--r--tools/perf/util/counts.c1
-rw-r--r--tools/perf/util/data-convert-bt.c1
-rw-r--r--tools/perf/util/data.c1
-rw-r--r--tools/perf/util/drv_configs.c1
-rw-r--r--tools/perf/util/dso.c1
-rw-r--r--tools/perf/util/dwarf-aux.c1
-rw-r--r--tools/perf/util/env.c1
-rw-r--r--tools/perf/util/event.c1
-rw-r--r--tools/perf/util/evlist.c1
-rw-r--r--tools/perf/util/evsel.c1
-rw-r--r--tools/perf/util/header.c1
-rw-r--r--tools/perf/util/hist.c1
-rw-r--r--tools/perf/util/intel-bts.c1
-rw-r--r--tools/perf/util/jitdump.c1
-rw-r--r--tools/perf/util/lzma.c1
-rw-r--r--tools/perf/util/machine.c1
-rw-r--r--tools/perf/util/ordered-events.c1
-rw-r--r--tools/perf/util/parse-events.c1
-rw-r--r--tools/perf/util/pmu.c1
-rw-r--r--tools/perf/util/probe-file.c1
-rw-r--r--tools/perf/util/quote.c1
-rw-r--r--tools/perf/util/record.c1
-rw-r--r--tools/perf/util/session.c1
-rw-r--r--tools/perf/util/sort.c1
-rw-r--r--tools/perf/util/stat.c1
-rw-r--r--tools/perf/util/strbuf.c1
-rw-r--r--tools/perf/util/strfilter.c1
-rw-r--r--tools/perf/util/symbol-minimal.c1
-rw-r--r--tools/perf/util/thread-stack.c1
-rw-r--r--tools/perf/util/thread.c1
-rw-r--r--tools/perf/util/thread_map.c1
-rw-r--r--tools/perf/util/unwind-libunwind-local.c1
-rw-r--r--tools/perf/util/util.h1
-rw-r--r--tools/perf/util/vdso.c2
95 files changed, 96 insertions, 2 deletions
diff --git a/tools/perf/arch/arm64/util/dwarf-regs.c b/tools/perf/arch/arm64/util/dwarf-regs.c
index aea610c292e6..f268720ff021 100644
--- a/tools/perf/arch/arm64/util/dwarf-regs.c
+++ b/tools/perf/arch/arm64/util/dwarf-regs.c
@@ -8,6 +8,7 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11#include <errno.h>
11#include <stddef.h> 12#include <stddef.h>
12#include <dwarf-regs.h> 13#include <dwarf-regs.h>
13#include <linux/ptrace.h> /* for struct user_pt_regs */ 14#include <linux/ptrace.h> /* for struct user_pt_regs */
diff --git a/tools/perf/arch/powerpc/util/kvm-stat.c b/tools/perf/arch/powerpc/util/kvm-stat.c
index 74eee30398f8..249723f0e6a9 100644
--- a/tools/perf/arch/powerpc/util/kvm-stat.c
+++ b/tools/perf/arch/powerpc/util/kvm-stat.c
@@ -1,3 +1,4 @@
1#include <errno.h>
1#include "util/kvm-stat.h" 2#include "util/kvm-stat.h"
2#include "util/parse-events.h" 3#include "util/parse-events.h"
3#include "util/debug.h" 4#include "util/debug.h"
diff --git a/tools/perf/arch/powerpc/util/perf_regs.c b/tools/perf/arch/powerpc/util/perf_regs.c
index 4268f7762e25..f860dc411f69 100644
--- a/tools/perf/arch/powerpc/util/perf_regs.c
+++ b/tools/perf/arch/powerpc/util/perf_regs.c
@@ -1,3 +1,4 @@
1#include <errno.h>
1#include <string.h> 2#include <string.h>
2#include <regex.h> 3#include <regex.h>
3 4
diff --git a/tools/perf/arch/s390/util/kvm-stat.c b/tools/perf/arch/s390/util/kvm-stat.c
index ed57df2e6d68..d233e2eb9592 100644
--- a/tools/perf/arch/s390/util/kvm-stat.c
+++ b/tools/perf/arch/s390/util/kvm-stat.c
@@ -9,6 +9,7 @@
9 * as published by the Free Software Foundation. 9 * as published by the Free Software Foundation.
10 */ 10 */
11 11
12#include <errno.h>
12#include "../../util/kvm-stat.h" 13#include "../../util/kvm-stat.h"
13#include <asm/sie.h> 14#include <asm/sie.h>
14 15
diff --git a/tools/perf/arch/x86/tests/intel-cqm.c b/tools/perf/arch/x86/tests/intel-cqm.c
index 7f064eb37158..03c62eb0106b 100644
--- a/tools/perf/arch/x86/tests/intel-cqm.c
+++ b/tools/perf/arch/x86/tests/intel-cqm.c
@@ -7,6 +7,7 @@
7#include "arch-tests.h" 7#include "arch-tests.h"
8 8
9#include <sys/mman.h> 9#include <sys/mman.h>
10#include <errno.h>
10#include <string.h> 11#include <string.h>
11 12
12static pid_t spawn(void) 13static pid_t spawn(void)
diff --git a/tools/perf/arch/x86/tests/perf-time-to-tsc.c b/tools/perf/arch/x86/tests/perf-time-to-tsc.c
index a8e37f3148c2..e3ae9cff2b67 100644
--- a/tools/perf/arch/x86/tests/perf-time-to-tsc.c
+++ b/tools/perf/arch/x86/tests/perf-time-to-tsc.c
@@ -1,3 +1,4 @@
1#include <errno.h>
1#include <inttypes.h> 2#include <inttypes.h>
2#include <stdio.h> 3#include <stdio.h>
3#include <unistd.h> 4#include <unistd.h>
diff --git a/tools/perf/arch/x86/util/auxtrace.c b/tools/perf/arch/x86/util/auxtrace.c
index cc1d865e31f1..6aa3f2a38321 100644
--- a/tools/perf/arch/x86/util/auxtrace.c
+++ b/tools/perf/arch/x86/util/auxtrace.c
@@ -13,6 +13,7 @@
13 * 13 *
14 */ 14 */
15 15
16#include <errno.h>
16#include <stdbool.h> 17#include <stdbool.h>
17 18
18#include "../../util/header.h" 19#include "../../util/header.h"
diff --git a/tools/perf/arch/x86/util/intel-bts.c b/tools/perf/arch/x86/util/intel-bts.c
index 5132775a044f..af2bce7a2cd6 100644
--- a/tools/perf/arch/x86/util/intel-bts.c
+++ b/tools/perf/arch/x86/util/intel-bts.c
@@ -13,6 +13,7 @@
13 * 13 *
14 */ 14 */
15 15
16#include <errno.h>
16#include <linux/kernel.h> 17#include <linux/kernel.h>
17#include <linux/types.h> 18#include <linux/types.h>
18#include <linux/bitops.h> 19#include <linux/bitops.h>
diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c
index 90fa2286edcf..f630de0206a1 100644
--- a/tools/perf/arch/x86/util/intel-pt.c
+++ b/tools/perf/arch/x86/util/intel-pt.c
@@ -13,6 +13,7 @@
13 * 13 *
14 */ 14 */
15 15
16#include <errno.h>
16#include <stdbool.h> 17#include <stdbool.h>
17#include <linux/kernel.h> 18#include <linux/kernel.h>
18#include <linux/types.h> 19#include <linux/types.h>
diff --git a/tools/perf/arch/x86/util/kvm-stat.c b/tools/perf/arch/x86/util/kvm-stat.c
index b63d4be655a2..bf817beca0a8 100644
--- a/tools/perf/arch/x86/util/kvm-stat.c
+++ b/tools/perf/arch/x86/util/kvm-stat.c
@@ -1,3 +1,4 @@
1#include <errno.h>
1#include "../../util/kvm-stat.h" 2#include "../../util/kvm-stat.h"
2#include <asm/svm.h> 3#include <asm/svm.h>
3#include <asm/vmx.h> 4#include <asm/vmx.h>
diff --git a/tools/perf/arch/x86/util/perf_regs.c b/tools/perf/arch/x86/util/perf_regs.c
index 3bf3548c5e2d..f95edebfb716 100644
--- a/tools/perf/arch/x86/util/perf_regs.c
+++ b/tools/perf/arch/x86/util/perf_regs.c
@@ -1,3 +1,4 @@
1#include <errno.h>
1#include <string.h> 2#include <string.h>
2#include <regex.h> 3#include <regex.h>
3 4
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index b2b2722f6bb7..7a5dc7e5c577 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -33,6 +33,7 @@
33#include "util/block-range.h" 33#include "util/block-range.h"
34 34
35#include <dlfcn.h> 35#include <dlfcn.h>
36#include <errno.h>
36#include <linux/bitmap.h> 37#include <linux/bitmap.h>
37 38
38struct perf_annotate { 39struct perf_annotate {
diff --git a/tools/perf/builtin-buildid-cache.c b/tools/perf/builtin-buildid-cache.c
index 94b55eee0d9b..034c3d4a7b27 100644
--- a/tools/perf/builtin-buildid-cache.c
+++ b/tools/perf/builtin-buildid-cache.c
@@ -10,6 +10,7 @@
10#include <sys/time.h> 10#include <sys/time.h>
11#include <time.h> 11#include <time.h>
12#include <dirent.h> 12#include <dirent.h>
13#include <errno.h>
13#include <unistd.h> 14#include <unistd.h>
14#include "builtin.h" 15#include "builtin.h"
15#include "perf.h" 16#include "perf.h"
diff --git a/tools/perf/builtin-buildid-list.c b/tools/perf/builtin-buildid-list.c
index 26f4e608207f..fdaca16e0c74 100644
--- a/tools/perf/builtin-buildid-list.c
+++ b/tools/perf/builtin-buildid-list.c
@@ -16,6 +16,7 @@
16#include "util/session.h" 16#include "util/session.h"
17#include "util/symbol.h" 17#include "util/symbol.h"
18#include "util/data.h" 18#include "util/data.h"
19#include <errno.h>
19 20
20static int sysfs__fprintf_build_id(FILE *fp) 21static int sysfs__fprintf_build_id(FILE *fp)
21{ 22{
diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index cc8156a969ac..a90c1260f49e 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -9,6 +9,7 @@
9 * Dick Fowles <fowles@inreach.com> 9 * Dick Fowles <fowles@inreach.com>
10 * Joe Mario <jmario@redhat.com> 10 * Joe Mario <jmario@redhat.com>
11 */ 11 */
12#include <errno.h>
12#include <inttypes.h> 13#include <inttypes.h>
13#include <linux/compiler.h> 14#include <linux/compiler.h>
14#include <linux/kernel.h> 15#include <linux/kernel.h>
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 09be77b13788..eec5df80f5a3 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -19,6 +19,7 @@
19#include "util/data.h" 19#include "util/data.h"
20#include "util/config.h" 20#include "util/config.h"
21 21
22#include <errno.h>
22#include <inttypes.h> 23#include <inttypes.h>
23#include <stdlib.h> 24#include <stdlib.h>
24#include <math.h> 25#include <math.h>
diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
index f80fb60b00b0..67d14037c03e 100644
--- a/tools/perf/builtin-ftrace.c
+++ b/tools/perf/builtin-ftrace.c
@@ -9,6 +9,7 @@
9#include "builtin.h" 9#include "builtin.h"
10#include "perf.h" 10#include "perf.h"
11 11
12#include <errno.h>
12#include <unistd.h> 13#include <unistd.h>
13#include <signal.h> 14#include <signal.h>
14#include <fcntl.h> 15#include <fcntl.h>
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index 1f18385907f5..7bde2f59dac2 100644
--- a/tools/perf/builtin-help.c
+++ b/tools/perf/builtin-help.c
@@ -13,6 +13,7 @@
13#include <subcmd/help.h> 13#include <subcmd/help.h>
14#include "util/debug.h" 14#include "util/debug.h"
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <errno.h>
16 17
17static struct man_viewer_list { 18static struct man_viewer_list {
18 struct man_viewer_list *next; 19 struct man_viewer_list *next;
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index 65e1c026a2f0..b102ee702aa1 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -22,6 +22,7 @@
22#include <subcmd/parse-options.h> 22#include <subcmd/parse-options.h>
23 23
24#include <linux/list.h> 24#include <linux/list.h>
25#include <errno.h>
25 26
26struct perf_inject { 27struct perf_inject {
27 struct perf_tool tool; 28 struct perf_tool tool;
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index 15754a492cad..9409c9464667 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -23,6 +23,7 @@
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/rbtree.h> 24#include <linux/rbtree.h>
25#include <linux/string.h> 25#include <linux/string.h>
26#include <errno.h>
26#include <inttypes.h> 27#include <inttypes.h>
27#include <locale.h> 28#include <locale.h>
28#include <regex.h> 29#include <regex.h>
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index e82a6979327f..40660428fa72 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -26,6 +26,7 @@
26 26
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/time64.h> 28#include <linux/time64.h>
29#include <errno.h>
29#include <inttypes.h> 30#include <inttypes.h>
30#include <termios.h> 31#include <termios.h>
31#include <semaphore.h> 32#include <semaphore.h>
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index 6f93a6f0e268..ff98652484a7 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -1,3 +1,4 @@
1#include <errno.h>
1#include <inttypes.h> 2#include <inttypes.h>
2#include "builtin.h" 3#include "builtin.h"
3#include "perf.h" 4#include "perf.h"
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 65429d1b29c8..70340ff2008d 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -40,6 +40,7 @@
40#include "util/perf-hooks.h" 40#include "util/perf-hooks.h"
41#include "asm/bug.h" 41#include "asm/bug.h"
42 42
43#include <errno.h>
43#include <inttypes.h> 44#include <inttypes.h>
44#include <unistd.h> 45#include <unistd.h>
45#include <sched.h> 46#include <sched.h>
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 66a2f44518de..2941d8df4d40 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -40,6 +40,7 @@
40#include "util/auxtrace.h" 40#include "util/auxtrace.h"
41 41
42#include <dlfcn.h> 42#include <dlfcn.h>
43#include <errno.h>
43#include <inttypes.h> 44#include <inttypes.h>
44#include <linux/bitmap.h> 45#include <linux/bitmap.h>
45#include <linux/stringify.h> 46#include <linux/stringify.h>
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index aefab93d7d2f..39996c53995a 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -28,6 +28,7 @@
28#include <sys/resource.h> 28#include <sys/resource.h>
29#include <inttypes.h> 29#include <inttypes.h>
30 30
31#include <errno.h>
31#include <semaphore.h> 32#include <semaphore.h>
32#include <pthread.h> 33#include <pthread.h>
33#include <math.h> 34#include <math.h>
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index a710f6867954..853651a0f720 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -32,6 +32,7 @@
32#include "asm/bug.h" 32#include "asm/bug.h"
33#include "util/mem-events.h" 33#include "util/mem-events.h"
34#include "util/dump-insn.h" 34#include "util/dump-insn.h"
35#include <errno.h>
35#include <inttypes.h> 36#include <inttypes.h>
36 37
37#include "sane_ctype.h" 38#include "sane_ctype.h"
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 1da86e6708c0..be2cd537c537 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -69,6 +69,7 @@
69 69
70#include <linux/time64.h> 70#include <linux/time64.h>
71#include <api/fs/fs.h> 71#include <api/fs/fs.h>
72#include <errno.h>
72#include <stdlib.h> 73#include <stdlib.h>
73#include <sys/prctl.h> 74#include <sys/prctl.h>
74#include <inttypes.h> 75#include <inttypes.h>
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index a24b229a785f..e2576c8f6d4e 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -12,6 +12,7 @@
12 * of the License. 12 * of the License.
13 */ 13 */
14 14
15#include <errno.h>
15#include <inttypes.h> 16#include <inttypes.h>
16#include <traceevent/event-parse.h> 17#include <traceevent/event-parse.h>
17 18
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 4160d946a34d..e065c4a12f58 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -41,6 +41,7 @@
41#include "syscalltbl.h" 41#include "syscalltbl.h"
42#include "rb_resort.h" 42#include "rb_resort.h"
43 43
44#include <errno.h>
44#include <inttypes.h> 45#include <inttypes.h>
45#include <libaudit.h> /* FIXME: Still needed for audit_errno_to_name */ 46#include <libaudit.h> /* FIXME: Still needed for audit_errno_to_name */
46#include <stdlib.h> 47#include <stdlib.h>
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 94e9418aecb1..9ccccb0fbd8f 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 <api/fs/fs.h> 20#include <api/fs/fs.h>
21#include <api/fs/tracing_path.h> 21#include <api/fs/tracing_path.h>
22#include <errno.h>
22#include <pthread.h> 23#include <pthread.h>
23#include <stdlib.h> 24#include <stdlib.h>
24#include <time.h> 25#include <time.h>
diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index bb2bc487f703..ba87cd529bfc 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -18,6 +18,7 @@
18 * permissions. All the event text files are stored there. 18 * permissions. All the event text files are stored there.
19 */ 19 */
20 20
21#include <errno.h>
21#include <inttypes.h> 22#include <inttypes.h>
22#include <stdlib.h> 23#include <stdlib.h>
23#include <stdio.h> 24#include <stdio.h>
diff --git a/tools/perf/tests/backward-ring-buffer.c b/tools/perf/tests/backward-ring-buffer.c
index 42e892b1e979..50f6d7afee58 100644
--- a/tools/perf/tests/backward-ring-buffer.c
+++ b/tools/perf/tests/backward-ring-buffer.c
@@ -8,6 +8,7 @@
8#include <sys/prctl.h> 8#include <sys/prctl.h>
9#include "tests.h" 9#include "tests.h"
10#include "debug.h" 10#include "debug.h"
11#include <errno.h>
11 12
12#define NR_ITERS 111 13#define NR_ITERS 111
13 14
diff --git a/tools/perf/tests/bpf.c b/tools/perf/tests/bpf.c
index 67fe5eeff021..b78fbd611a7c 100644
--- a/tools/perf/tests/bpf.c
+++ b/tools/perf/tests/bpf.c
@@ -1,3 +1,4 @@
1#include <errno.h>
1#include <stdio.h> 2#include <stdio.h>
2#include <sys/epoll.h> 3#include <sys/epoll.h>
3#include <util/util.h> 4#include <util/util.h>
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index f029737ad255..552fd9aca08d 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -3,6 +3,7 @@
3 * 3 *
4 * Builtin regression testing command: ever growing number of sanity tests 4 * Builtin regression testing command: ever growing number of sanity tests
5 */ 5 */
6#include <errno.h>
6#include <unistd.h> 7#include <unistd.h>
7#include <string.h> 8#include <string.h>
8#include "builtin.h" 9#include "builtin.h"
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index fe6aac82d54e..3a8bf1565493 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -1,3 +1,4 @@
1#include <errno.h>
1#include <linux/kernel.h> 2#include <linux/kernel.h>
2#include <linux/types.h> 3#include <linux/types.h>
3#include <inttypes.h> 4#include <inttypes.h>
diff --git a/tools/perf/tests/event-times.c b/tools/perf/tests/event-times.c
index 8d376e155697..4683514751d6 100644
--- a/tools/perf/tests/event-times.c
+++ b/tools/perf/tests/event-times.c
@@ -1,4 +1,5 @@
1#include <linux/compiler.h> 1#include <linux/compiler.h>
2#include <errno.h>
2#include <inttypes.h> 3#include <inttypes.h>
3#include <string.h> 4#include <string.h>
4#include "tests.h" 5#include "tests.h"
diff --git a/tools/perf/tests/evsel-roundtrip-name.c b/tools/perf/tests/evsel-roundtrip-name.c
index 9221d2732cc4..d2bea6f780f8 100644
--- a/tools/perf/tests/evsel-roundtrip-name.c
+++ b/tools/perf/tests/evsel-roundtrip-name.c
@@ -3,6 +3,7 @@
3#include "parse-events.h" 3#include "parse-events.h"
4#include "tests.h" 4#include "tests.h"
5#include "debug.h" 5#include "debug.h"
6#include <errno.h>
6#include <linux/kernel.h> 7#include <linux/kernel.h>
7 8
8static int perf_evsel__roundtrip_cache_name_test(void) 9static int perf_evsel__roundtrip_cache_name_test(void)
diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c
index 1bd26d23c2fc..a26cbb79e988 100644
--- a/tools/perf/tests/hists_link.c
+++ b/tools/perf/tests/hists_link.c
@@ -9,6 +9,7 @@
9#include "thread.h" 9#include "thread.h"
10#include "parse-events.h" 10#include "parse-events.h"
11#include "hists_common.h" 11#include "hists_common.h"
12#include <errno.h>
12#include <linux/kernel.h> 13#include <linux/kernel.h>
13 14
14struct sample { 15struct sample {
diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c
index aba40eb4c56f..15c770856aac 100644
--- a/tools/perf/tests/mmap-basic.c
+++ b/tools/perf/tests/mmap-basic.c
@@ -1,3 +1,4 @@
1#include <errno.h>
1#include <inttypes.h> 2#include <inttypes.h>
2/* For the CLR_() macros */ 3/* For the CLR_() macros */
3#include <pthread.h> 4#include <pthread.h>
diff --git a/tools/perf/tests/openat-syscall-all-cpus.c b/tools/perf/tests/openat-syscall-all-cpus.c
index eb7b1a6d507e..b7dece0de42c 100644
--- a/tools/perf/tests/openat-syscall-all-cpus.c
+++ b/tools/perf/tests/openat-syscall-all-cpus.c
@@ -1,3 +1,4 @@
1#include <errno.h>
1#include <inttypes.h> 2#include <inttypes.h>
2/* For the CPU_* macros */ 3/* For the CPU_* macros */
3#include <pthread.h> 4#include <pthread.h>
diff --git a/tools/perf/tests/openat-syscall-tp-fields.c b/tools/perf/tests/openat-syscall-tp-fields.c
index f52239fed361..9788fac91095 100644
--- a/tools/perf/tests/openat-syscall-tp-fields.c
+++ b/tools/perf/tests/openat-syscall-tp-fields.c
@@ -5,6 +5,7 @@
5#include "thread_map.h" 5#include "thread_map.h"
6#include "tests.h" 6#include "tests.h"
7#include "debug.h" 7#include "debug.h"
8#include <errno.h>
8 9
9#ifndef O_DIRECTORY 10#ifndef O_DIRECTORY
10#define O_DIRECTORY 00200000 11#define O_DIRECTORY 00200000
diff --git a/tools/perf/tests/openat-syscall.c b/tools/perf/tests/openat-syscall.c
index 5964938d4b85..5f0c700b4693 100644
--- a/tools/perf/tests/openat-syscall.c
+++ b/tools/perf/tests/openat-syscall.c
@@ -1,3 +1,4 @@
1#include <errno.h>
1#include <inttypes.h> 2#include <inttypes.h>
2#include <api/fs/tracing_path.h> 3#include <api/fs/tracing_path.h>
3#include <linux/err.h> 4#include <linux/err.h>
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 05621748aead..66ecc3f5f618 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -5,6 +5,7 @@
5#include "tests.h" 5#include "tests.h"
6#include "debug.h" 6#include "debug.h"
7#include "util.h" 7#include "util.h"
8#include <errno.h>
8#include <linux/kernel.h> 9#include <linux/kernel.h>
9#include <linux/hw_breakpoint.h> 10#include <linux/hw_breakpoint.h>
10#include <api/fs/fs.h> 11#include <api/fs/fs.h>
diff --git a/tools/perf/tests/perf-record.c b/tools/perf/tests/perf-record.c
index a8b6fdaf8df1..d37cd9588cc0 100644
--- a/tools/perf/tests/perf-record.c
+++ b/tools/perf/tests/perf-record.c
@@ -1,3 +1,4 @@
1#include <errno.h>
1#include <inttypes.h> 2#include <inttypes.h>
2/* For the CLR_() macros */ 3/* For the CLR_() macros */
3#include <pthread.h> 4#include <pthread.h>
diff --git a/tools/perf/tests/pmu.c b/tools/perf/tests/pmu.c
index de6498dc4cbb..a6d7aef30030 100644
--- a/tools/perf/tests/pmu.c
+++ b/tools/perf/tests/pmu.c
@@ -2,6 +2,7 @@
2#include "pmu.h" 2#include "pmu.h"
3#include "util.h" 3#include "util.h"
4#include "tests.h" 4#include "tests.h"
5#include <errno.h>
5#include <linux/kernel.h> 6#include <linux/kernel.h>
6 7
7/* Simulated format definitions. */ 8/* Simulated format definitions. */
diff --git a/tools/perf/tests/sdt.c b/tools/perf/tests/sdt.c
index 26e5b7a0b839..f73b3c5e125d 100644
--- a/tools/perf/tests/sdt.c
+++ b/tools/perf/tests/sdt.c
@@ -1,3 +1,4 @@
1#include <errno.h>
1#include <stdio.h> 2#include <stdio.h>
2#include <sys/epoll.h> 3#include <sys/epoll.h>
3#include <util/util.h> 4#include <util/util.h>
diff --git a/tools/perf/tests/sw-clock.c b/tools/perf/tests/sw-clock.c
index 29f11c4b3e60..828494db4a19 100644
--- a/tools/perf/tests/sw-clock.c
+++ b/tools/perf/tests/sw-clock.c
@@ -1,3 +1,4 @@
1#include <errno.h>
1#include <inttypes.h> 2#include <inttypes.h>
2#include <unistd.h> 3#include <unistd.h>
3#include <stdlib.h> 4#include <stdlib.h>
diff --git a/tools/perf/tests/switch-tracking.c b/tools/perf/tests/switch-tracking.c
index 7ddbe267d0ac..65474fd80da7 100644
--- a/tools/perf/tests/switch-tracking.c
+++ b/tools/perf/tests/switch-tracking.c
@@ -1,5 +1,6 @@
1#include <sys/time.h> 1#include <sys/time.h>
2#include <sys/prctl.h> 2#include <sys/prctl.h>
3#include <errno.h>
3#include <time.h> 4#include <time.h>
4#include <stdlib.h> 5#include <stdlib.h>
5 6
diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c
index 01a5ba2788c6..32873ec91a4e 100644
--- a/tools/perf/tests/task-exit.c
+++ b/tools/perf/tests/task-exit.c
@@ -4,6 +4,7 @@
4#include "cpumap.h" 4#include "cpumap.h"
5#include "tests.h" 5#include "tests.h"
6 6
7#include <errno.h>
7#include <signal.h> 8#include <signal.h>
8 9
9static int exited; 10static int exited;
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index bc397bbbc3a7..0916575c6694 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1,3 +1,4 @@
1#include <errno.h>
1#include <inttypes.h> 2#include <inttypes.h>
2#include <stdio.h> 3#include <stdio.h>
3#include <stdlib.h> 4#include <stdlib.h>
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 297bf5c66609..683f8340460c 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -7,6 +7,7 @@
7 * Released under the GPL v2. (and only v2, not any later version) 7 * Released under the GPL v2. (and only v2, not any later version)
8 */ 8 */
9 9
10#include <errno.h>
10#include <inttypes.h> 11#include <inttypes.h>
11#include "util.h" 12#include "util.h"
12#include "ui/ui.h" 13#include "ui/ui.h"
diff --git a/tools/perf/util/auxtrace.h b/tools/perf/util/auxtrace.h
index 26fb1ee5746a..9f0de72d58e2 100644
--- a/tools/perf/util/auxtrace.h
+++ b/tools/perf/util/auxtrace.h
@@ -17,6 +17,7 @@
17#define __PERF_AUXTRACE_H 17#define __PERF_AUXTRACE_H
18 18
19#include <sys/types.h> 19#include <sys/types.h>
20#include <errno.h>
20#include <stdbool.h> 21#include <stdbool.h>
21#include <stddef.h> 22#include <stddef.h>
22#include <linux/list.h> 23#include <linux/list.h>
diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
index 27af9d62d899..bf21c1ca9771 100644
--- a/tools/perf/util/bpf-loader.c
+++ b/tools/perf/util/bpf-loader.c
@@ -11,6 +11,7 @@
11#include <linux/err.h> 11#include <linux/err.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/string.h> 13#include <linux/string.h>
14#include <errno.h>
14#include "perf.h" 15#include "perf.h"
15#include "debug.h" 16#include "debug.h"
16#include "bpf-loader.h" 17#include "bpf-loader.h"
diff --git a/tools/perf/util/bpf-loader.h b/tools/perf/util/bpf-loader.h
index f2b737b225f2..48863867878b 100644
--- a/tools/perf/util/bpf-loader.h
+++ b/tools/perf/util/bpf-loader.h
@@ -85,6 +85,8 @@ int bpf__strerror_setup_stdout(struct perf_evlist *evlist, int err,
85 char *buf, size_t size); 85 char *buf, size_t size);
86 86
87#else 87#else
88#include <errno.h>
89
88static inline struct bpf_object * 90static inline struct bpf_object *
89bpf__prepare_load(const char *filename __maybe_unused, 91bpf__prepare_load(const char *filename __maybe_unused,
90 bool source __maybe_unused) 92 bool source __maybe_unused)
diff --git a/tools/perf/util/bpf-prologue.c b/tools/perf/util/bpf-prologue.c
index 6cdbee119ceb..1356220a9f1b 100644
--- a/tools/perf/util/bpf-prologue.c
+++ b/tools/perf/util/bpf-prologue.c
@@ -12,6 +12,7 @@
12#include "bpf-loader.h" 12#include "bpf-loader.h"
13#include "bpf-prologue.h" 13#include "bpf-prologue.h"
14#include "probe-finder.h" 14#include "probe-finder.h"
15#include <errno.h>
15#include <dwarf-regs.h> 16#include <dwarf-regs.h>
16#include <linux/filter.h> 17#include <linux/filter.h>
17 18
diff --git a/tools/perf/util/bpf-prologue.h b/tools/perf/util/bpf-prologue.h
index d94cbea12899..ba564838375f 100644
--- a/tools/perf/util/bpf-prologue.h
+++ b/tools/perf/util/bpf-prologue.h
@@ -18,6 +18,8 @@ int bpf__gen_prologue(struct probe_trace_arg *args, int nargs,
18 struct bpf_insn *new_prog, size_t *new_cnt, 18 struct bpf_insn *new_prog, size_t *new_cnt,
19 size_t cnt_space); 19 size_t cnt_space);
20#else 20#else
21#include <errno.h>
22
21static inline int 23static inline int
22bpf__gen_prologue(struct probe_trace_arg *args __maybe_unused, 24bpf__gen_prologue(struct probe_trace_arg *args __maybe_unused,
23 int nargs __maybe_unused, 25 int nargs __maybe_unused,
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index 3c0755563969..8d8ef1d31b1e 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -7,6 +7,7 @@
7 * Copyright (C) 2009, 2010 Arnaldo Carvalho de Melo <acme@redhat.com> 7 * Copyright (C) 2009, 2010 Arnaldo Carvalho de Melo <acme@redhat.com>
8 */ 8 */
9#include "util.h" 9#include "util.h"
10#include <errno.h>
10#include <stdio.h> 11#include <stdio.h>
11#include "build-id.h" 12#include "build-id.h"
12#include "event.h" 13#include "event.h"
diff --git a/tools/perf/util/c++/clang-c.h b/tools/perf/util/c++/clang-c.h
index 0eadd792ab1f..ccafcf72b37a 100644
--- a/tools/perf/util/c++/clang-c.h
+++ b/tools/perf/util/c++/clang-c.h
@@ -20,6 +20,7 @@ extern int perf_clang__compile_bpf(const char *filename,
20 size_t *p_obj_buf_sz); 20 size_t *p_obj_buf_sz);
21#else 21#else
22 22
23#include <errno.h>
23 24
24static inline void perf_clang__init(void) { } 25static inline void perf_clang__init(void) { }
25static inline void perf_clang__cleanup(void) { } 26static inline void perf_clang__cleanup(void) { }
diff --git a/tools/perf/util/cloexec.c b/tools/perf/util/cloexec.c
index f0dcd0ee0afa..4b4f00df58a8 100644
--- a/tools/perf/util/cloexec.c
+++ b/tools/perf/util/cloexec.c
@@ -1,3 +1,4 @@
1#include <errno.h>
1#include <sched.h> 2#include <sched.h>
2#include "util.h" 3#include "util.h"
3#include "../perf.h" 4#include "../perf.h"
diff --git a/tools/perf/util/comm.c b/tools/perf/util/comm.c
index 32837b6f7879..530a62a7b51e 100644
--- a/tools/perf/util/comm.c
+++ b/tools/perf/util/comm.c
@@ -1,5 +1,6 @@
1#include "comm.h" 1#include "comm.h"
2#include "util.h" 2#include "util.h"
3#include <errno.h>
3#include <stdlib.h> 4#include <stdlib.h>
4#include <stdio.h> 5#include <stdio.h>
5#include <linux/refcount.h> 6#include <linux/refcount.h>
diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
index 88783aa3dfc9..f5604039cbe4 100644
--- a/tools/perf/util/config.c
+++ b/tools/perf/util/config.c
@@ -8,6 +8,7 @@
8 * Copyright (C) Johannes Schindelin, 2005 8 * Copyright (C) Johannes Schindelin, 2005
9 * 9 *
10 */ 10 */
11#include <errno.h>
11#include "util.h" 12#include "util.h"
12#include "cache.h" 13#include "cache.h"
13#include <subcmd/exec-cmd.h> 14#include <subcmd/exec-cmd.h>
diff --git a/tools/perf/util/counts.c b/tools/perf/util/counts.c
index e3fde313deb2..83fedd0d22a1 100644
--- a/tools/perf/util/counts.c
+++ b/tools/perf/util/counts.c
@@ -1,3 +1,4 @@
1#include <errno.h>
1#include <stdlib.h> 2#include <stdlib.h>
2#include "evsel.h" 3#include "evsel.h"
3#include "counts.h" 4#include "counts.h"
diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c
index c3277b32e917..89d50318833d 100644
--- a/tools/perf/util/data-convert-bt.c
+++ b/tools/perf/util/data-convert-bt.c
@@ -7,6 +7,7 @@
7 * Released under the GPL v2. (and only v2, not any later version) 7 * Released under the GPL v2. (and only v2, not any later version)
8 */ 8 */
9 9
10#include <errno.h>
10#include <inttypes.h> 11#include <inttypes.h>
11#include <linux/compiler.h> 12#include <linux/compiler.h>
12#include <linux/kernel.h> 13#include <linux/kernel.h>
diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c
index 60bfc9ca1e22..e84bbc8ec058 100644
--- a/tools/perf/util/data.c
+++ b/tools/perf/util/data.c
@@ -2,6 +2,7 @@
2#include <linux/kernel.h> 2#include <linux/kernel.h>
3#include <sys/types.h> 3#include <sys/types.h>
4#include <sys/stat.h> 4#include <sys/stat.h>
5#include <errno.h>
5#include <unistd.h> 6#include <unistd.h>
6#include <string.h> 7#include <string.h>
7 8
diff --git a/tools/perf/util/drv_configs.c b/tools/perf/util/drv_configs.c
index 1647f285c629..eec754243f4d 100644
--- a/tools/perf/util/drv_configs.c
+++ b/tools/perf/util/drv_configs.c
@@ -17,6 +17,7 @@
17#include "evlist.h" 17#include "evlist.h"
18#include "evsel.h" 18#include "evsel.h"
19#include "pmu.h" 19#include "pmu.h"
20#include <errno.h>
20 21
21static int 22static int
22perf_evsel__apply_drv_configs(struct perf_evsel *evsel, 23perf_evsel__apply_drv_configs(struct perf_evsel *evsel,
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 6ad57730a0ed..cd061dc1de70 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -2,6 +2,7 @@
2#include <linux/kernel.h> 2#include <linux/kernel.h>
3#include <sys/time.h> 3#include <sys/time.h>
4#include <sys/resource.h> 4#include <sys/resource.h>
5#include <errno.h>
5#include "symbol.h" 6#include "symbol.h"
6#include "dso.h" 7#include "dso.h"
7#include "machine.h" 8#include "machine.h"
diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c
index 780ee4629bd0..f5acda13dcfa 100644
--- a/tools/perf/util/dwarf-aux.c
+++ b/tools/perf/util/dwarf-aux.c
@@ -17,6 +17,7 @@
17 * 17 *
18 */ 18 */
19 19
20#include <errno.h>
20#include <inttypes.h> 21#include <inttypes.h>
21#include <stdbool.h> 22#include <stdbool.h>
22#include "util.h" 23#include "util.h"
diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c
index 075fc77286bf..9e21538c42ae 100644
--- a/tools/perf/util/env.c
+++ b/tools/perf/util/env.c
@@ -1,6 +1,7 @@
1#include "cpumap.h" 1#include "cpumap.h"
2#include "env.h" 2#include "env.h"
3#include "util.h" 3#include "util.h"
4#include <errno.h>
4 5
5struct perf_env perf_env; 6struct perf_env perf_env;
6 7
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 53b81b2283c1..1fc1217a0c2c 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -1,3 +1,4 @@
1#include <errno.h>
1#include <inttypes.h> 2#include <inttypes.h>
2#include <linux/kernel.h> 3#include <linux/kernel.h>
3#include <linux/types.h> 4#include <linux/types.h>
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index cf27039df100..f74ea2e55fde 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -8,6 +8,7 @@
8 */ 8 */
9#include "util.h" 9#include "util.h"
10#include <api/fs/fs.h> 10#include <api/fs/fs.h>
11#include <errno.h>
11#include <inttypes.h> 12#include <inttypes.h>
12#include <poll.h> 13#include <poll.h>
13#include "cpumap.h" 14#include "cpumap.h"
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 757f73c4fa95..44a7aef3911b 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -8,6 +8,7 @@
8 */ 8 */
9 9
10#include <byteswap.h> 10#include <byteswap.h>
11#include <errno.h>
11#include <inttypes.h> 12#include <inttypes.h>
12#include <linux/bitops.h> 13#include <linux/bitops.h>
13#include <api/fs/tracing_path.h> 14#include <api/fs/tracing_path.h>
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 51865b8cb9f3..28a3acb7b313 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -1,3 +1,4 @@
1#include <errno.h>
1#include <inttypes.h> 2#include <inttypes.h>
2#include "util.h" 3#include "util.h"
3#include "string2.h" 4#include "string2.h"
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index af3bd5d31d99..65d42758aadd 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -10,6 +10,7 @@
10#include "annotate.h" 10#include "annotate.h"
11#include "srcline.h" 11#include "srcline.h"
12#include "ui/progress.h" 12#include "ui/progress.h"
13#include <errno.h>
13#include <math.h> 14#include <math.h>
14 15
15static bool hists__filter_entry_by_dso(struct hists *hists, 16static bool hists__filter_entry_by_dso(struct hists *hists,
diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c
index 471ed8b26a1c..b2834ac7b1f5 100644
--- a/tools/perf/util/intel-bts.c
+++ b/tools/perf/util/intel-bts.c
@@ -14,6 +14,7 @@
14 */ 14 */
15 15
16#include <endian.h> 16#include <endian.h>
17#include <errno.h>
17#include <byteswap.h> 18#include <byteswap.h>
18#include <inttypes.h> 19#include <inttypes.h>
19#include <linux/kernel.h> 20#include <linux/kernel.h>
diff --git a/tools/perf/util/jitdump.c b/tools/perf/util/jitdump.c
index d6d25327bc92..388078d84eed 100644
--- a/tools/perf/util/jitdump.c
+++ b/tools/perf/util/jitdump.c
@@ -1,5 +1,6 @@
1#include <sys/sysmacros.h> 1#include <sys/sysmacros.h>
2#include <sys/types.h> 2#include <sys/types.h>
3#include <errno.h>
3#include <stdio.h> 4#include <stdio.h>
4#include <stdlib.h> 5#include <stdlib.h>
5#include <string.h> 6#include <string.h>
diff --git a/tools/perf/util/lzma.c b/tools/perf/util/lzma.c
index 9ddea5cecd94..5b73b268c169 100644
--- a/tools/perf/util/lzma.c
+++ b/tools/perf/util/lzma.c
@@ -1,3 +1,4 @@
1#include <errno.h>
1#include <lzma.h> 2#include <lzma.h>
2#include <stdio.h> 3#include <stdio.h>
3#include <linux/compiler.h> 4#include <linux/compiler.h>
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index f13f46a99b36..cdbfe3e32e5a 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1,3 +1,4 @@
1#include <errno.h>
1#include <inttypes.h> 2#include <inttypes.h>
2#include "callchain.h" 3#include "callchain.h"
3#include "debug.h" 4#include "debug.h"
diff --git a/tools/perf/util/ordered-events.c b/tools/perf/util/ordered-events.c
index df05be69cc9e..4de398cfb577 100644
--- a/tools/perf/util/ordered-events.c
+++ b/tools/perf/util/ordered-events.c
@@ -1,3 +1,4 @@
1#include <errno.h>
1#include <inttypes.h> 2#include <inttypes.h>
2#include <linux/list.h> 3#include <linux/list.h>
3#include <linux/compiler.h> 4#include <linux/compiler.h>
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 535c7cbb2bfb..d4877c8438e5 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -1,5 +1,6 @@
1#include <linux/hw_breakpoint.h> 1#include <linux/hw_breakpoint.h>
2#include <linux/err.h> 2#include <linux/err.h>
3#include <errno.h>
3#include "util.h" 4#include "util.h"
4#include "../perf.h" 5#include "../perf.h"
5#include "evlist.h" 6#include "evlist.h"
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 7503fa170249..bca1844594d0 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -1,6 +1,7 @@
1#include <linux/list.h> 1#include <linux/list.h>
2#include <linux/compiler.h> 2#include <linux/compiler.h>
3#include <sys/types.h> 3#include <sys/types.h>
4#include <errno.h>
4#include <unistd.h> 5#include <unistd.h>
5#include <stdio.h> 6#include <stdio.h>
6#include <stdbool.h> 7#include <stdbool.h>
diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
index 7942ea5c7e81..1ccaefdc05c4 100644
--- a/tools/perf/util/probe-file.c
+++ b/tools/perf/util/probe-file.c
@@ -14,6 +14,7 @@
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 * 15 *
16 */ 16 */
17#include <errno.h>
17#include <sys/uio.h> 18#include <sys/uio.h>
18#include "util.h" 19#include "util.h"
19#include "event.h" 20#include "event.h"
diff --git a/tools/perf/util/quote.c b/tools/perf/util/quote.c
index 293534c1a474..1ba8920151d8 100644
--- a/tools/perf/util/quote.c
+++ b/tools/perf/util/quote.c
@@ -1,3 +1,4 @@
1#include <errno.h>
1#include <stdlib.h> 2#include <stdlib.h>
2#include "strbuf.h" 3#include "strbuf.h"
3#include "quote.h" 4#include "quote.h"
diff --git a/tools/perf/util/record.c b/tools/perf/util/record.c
index 98bf584853ea..d91bdf5a1aa4 100644
--- a/tools/perf/util/record.c
+++ b/tools/perf/util/record.c
@@ -2,6 +2,7 @@
2#include "evsel.h" 2#include "evsel.h"
3#include "cpumap.h" 3#include "cpumap.h"
4#include "parse-events.h" 4#include "parse-events.h"
5#include <errno.h>
5#include <api/fs/fs.h> 6#include <api/fs/fs.h>
6#include "util.h" 7#include "util.h"
7#include "cloexec.h" 8#include "cloexec.h"
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 0695e08d2252..19d993f2a305 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1,3 +1,4 @@
1#include <errno.h>
1#include <inttypes.h> 2#include <inttypes.h>
2#include <linux/kernel.h> 3#include <linux/kernel.h>
3#include <traceevent/event-parse.h> 4#include <traceevent/event-parse.h>
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 63ad5374f364..9aa058e167e8 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1,3 +1,4 @@
1#include <errno.h>
1#include <inttypes.h> 2#include <inttypes.h>
2#include <sys/mman.h> 3#include <sys/mman.h>
3#include "sort.h" 4#include "sort.h"
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
index bbf30b2d1614..c58174443dc1 100644
--- a/tools/perf/util/stat.c
+++ b/tools/perf/util/stat.c
@@ -1,3 +1,4 @@
1#include <errno.h>
1#include <inttypes.h> 2#include <inttypes.h>
2#include <math.h> 3#include <math.h>
3#include "stat.h" 4#include "stat.h"
diff --git a/tools/perf/util/strbuf.c b/tools/perf/util/strbuf.c
index 817593908d47..e91b5e86f027 100644
--- a/tools/perf/util/strbuf.c
+++ b/tools/perf/util/strbuf.c
@@ -1,6 +1,7 @@
1#include "debug.h" 1#include "debug.h"
2#include "util.h" 2#include "util.h"
3#include <linux/kernel.h> 3#include <linux/kernel.h>
4#include <errno.h>
4 5
5int prefixcmp(const char *str, const char *prefix) 6int prefixcmp(const char *str, const char *prefix)
6{ 7{
diff --git a/tools/perf/util/strfilter.c b/tools/perf/util/strfilter.c
index 3b068e0e2d59..4dc0af669a30 100644
--- a/tools/perf/util/strfilter.c
+++ b/tools/perf/util/strfilter.c
@@ -2,6 +2,7 @@
2#include "string2.h" 2#include "string2.h"
3#include "strfilter.h" 3#include "strfilter.h"
4 4
5#include <errno.h>
5#include "sane_ctype.h" 6#include "sane_ctype.h"
6 7
7/* Operators */ 8/* Operators */
diff --git a/tools/perf/util/symbol-minimal.c b/tools/perf/util/symbol-minimal.c
index 870ef0f0659c..40bf5d4c0bfd 100644
--- a/tools/perf/util/symbol-minimal.c
+++ b/tools/perf/util/symbol-minimal.c
@@ -1,6 +1,7 @@
1#include "symbol.h" 1#include "symbol.h"
2#include "util.h" 2#include "util.h"
3 3
4#include <errno.h>
4#include <stdio.h> 5#include <stdio.h>
5#include <fcntl.h> 6#include <fcntl.h>
6#include <string.h> 7#include <string.h>
diff --git a/tools/perf/util/thread-stack.c b/tools/perf/util/thread-stack.c
index d3301529f6a7..dd17d6a38d3a 100644
--- a/tools/perf/util/thread-stack.c
+++ b/tools/perf/util/thread-stack.c
@@ -15,6 +15,7 @@
15 15
16#include <linux/rbtree.h> 16#include <linux/rbtree.h>
17#include <linux/list.h> 17#include <linux/list.h>
18#include <errno.h>
18#include "thread.h" 19#include "thread.h"
19#include "event.h" 20#include "event.h"
20#include "machine.h" 21#include "machine.h"
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index e8ce6abc5321..378c418ca0c1 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -1,4 +1,5 @@
1#include "../perf.h" 1#include "../perf.h"
2#include <errno.h>
2#include <stdlib.h> 3#include <stdlib.h>
3#include <stdio.h> 4#include <stdio.h>
4#include <string.h> 5#include <string.h>
diff --git a/tools/perf/util/thread_map.c b/tools/perf/util/thread_map.c
index ef86bf517e01..63ead7b06324 100644
--- a/tools/perf/util/thread_map.c
+++ b/tools/perf/util/thread_map.c
@@ -1,4 +1,5 @@
1#include <dirent.h> 1#include <dirent.h>
2#include <errno.h>
2#include <limits.h> 3#include <limits.h>
3#include <stdbool.h> 4#include <stdbool.h>
4#include <stdlib.h> 5#include <stdlib.h>
diff --git a/tools/perf/util/unwind-libunwind-local.c b/tools/perf/util/unwind-libunwind-local.c
index 788f4d3c76f5..f8455bed6e65 100644
--- a/tools/perf/util/unwind-libunwind-local.c
+++ b/tools/perf/util/unwind-libunwind-local.c
@@ -16,6 +16,7 @@
16 */ 16 */
17 17
18#include <elf.h> 18#include <elf.h>
19#include <errno.h>
19#include <gelf.h> 20#include <gelf.h>
20#include <fcntl.h> 21#include <fcntl.h>
21#include <inttypes.h> 22#include <inttypes.h>
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 850ca54d17a5..6fd9963be1c8 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -18,7 +18,6 @@
18#include <stdarg.h> 18#include <stdarg.h>
19#include <string.h> 19#include <string.h>
20#include <term.h> 20#include <term.h>
21#include <errno.h>
22#include <limits.h> 21#include <limits.h>
23#include <sys/param.h> 22#include <sys/param.h>
24#include <sys/types.h> 23#include <sys/types.h>
diff --git a/tools/perf/util/vdso.c b/tools/perf/util/vdso.c
index 7bdcad484225..d3c39eec89a8 100644
--- a/tools/perf/util/vdso.c
+++ b/tools/perf/util/vdso.c
@@ -1,4 +1,4 @@
1 1#include <errno.h>
2#include <unistd.h> 2#include <unistd.h>
3#include <stdio.h> 3#include <stdio.h>
4#include <string.h> 4#include <string.h>