* [PATCH 01/28] perf unwind arm64: Add missing errno.h header
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
@ 2017-04-19 16:16 ` Arnaldo Carvalho de Melo
2017-04-19 16:16 ` [PATCH 02/28] perf tools: Remove FLEX_ARRAY definition Arnaldo Carvalho de Melo
` (27 subsequent siblings)
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:16 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jean Pihet, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Since it uses EINVAL unconditionally, it needs to also unconditionally
include errno.h.
Detected when recent changes made errno.h not be included by chance when
tools/perf/arch/arm64/util/unwind-libunwind.c gets included by
tools/perf/util/libunwind/arm64.c.
Putting this changeset just before that change so that we don't lose
bisectability on arm64.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jean Pihet <jean.pihet@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Fixes: 8ab596afb97b ("perf tools ARM64: Wire up perf_regs and unwind support")
Link: http://lkml.kernel.org/n/tip-60zjev2o1locp5ivod38epa2@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/arch/arm64/util/unwind-libunwind.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/arch/arm64/util/unwind-libunwind.c b/tools/perf/arch/arm64/util/unwind-libunwind.c
index c116b713f7f7..b415dfdbccca 100644
--- a/tools/perf/arch/arm64/util/unwind-libunwind.c
+++ b/tools/perf/arch/arm64/util/unwind-libunwind.c
@@ -1,6 +1,6 @@
+#include <errno.h>
#ifndef REMOTE_UNWIND_LIBUNWIND
-#include <errno.h>
#include <libunwind.h>
#include "perf_regs.h"
#include "../../util/unwind.h"
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 02/28] perf tools: Remove FLEX_ARRAY definition
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
2017-04-19 16:16 ` [PATCH 01/28] perf unwind arm64: Add missing errno.h header Arnaldo Carvalho de Melo
@ 2017-04-19 16:16 ` Arnaldo Carvalho de Melo
2017-04-19 16:16 ` [PATCH 03/28] tools include: Introduce linux/bug.h, from the kernel sources Arnaldo Carvalho de Melo
` (26 subsequent siblings)
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:16 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
We rely on symbol->name[0] since the beginning of tools/perf/, never
having received any complaint about it, also all the containers build
perf just fine, so remove this git codebase remnant.
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-jsjpgojut8e22o2gtz83augk@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-help.c | 4 ++--
tools/perf/util/util.h | 22 ----------------------
2 files changed, 2 insertions(+), 24 deletions(-)
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index 1eec96a0fa67..9730fd409f3b 100644
--- a/tools/perf/builtin-help.c
+++ b/tools/perf/builtin-help.c
@@ -15,13 +15,13 @@
static struct man_viewer_list {
struct man_viewer_list *next;
- char name[FLEX_ARRAY];
+ char name[0];
} *man_viewer_list;
static struct man_viewer_info_list {
struct man_viewer_info_list *next;
const char *info;
- char name[FLEX_ARRAY];
+ char name[0];
} *man_viewer_info_list;
enum help_format {
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 7cf5752b38fd..df13658377e4 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -1,28 +1,6 @@
#ifndef GIT_COMPAT_UTIL_H
#define GIT_COMPAT_UTIL_H
-#ifndef FLEX_ARRAY
-/*
- * See if our compiler is known to support flexible array members.
- */
-#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
-# define FLEX_ARRAY /* empty */
-#elif defined(__GNUC__)
-# if (__GNUC__ >= 3)
-# define FLEX_ARRAY /* empty */
-# else
-# define FLEX_ARRAY 0 /* older GNU extension */
-# endif
-#endif
-
-/*
- * Otherwise, default to safer but a bit wasteful traditional style
- */
-#ifndef FLEX_ARRAY
-# define FLEX_ARRAY 1
-#endif
-#endif
-
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
#ifdef __GNUC__
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 03/28] tools include: Introduce linux/bug.h, from the kernel sources
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
2017-04-19 16:16 ` [PATCH 01/28] perf unwind arm64: Add missing errno.h header Arnaldo Carvalho de Melo
2017-04-19 16:16 ` [PATCH 02/28] perf tools: Remove FLEX_ARRAY definition Arnaldo Carvalho de Melo
@ 2017-04-19 16:16 ` Arnaldo Carvalho de Melo
2017-04-19 16:16 ` [PATCH 04/28] tools include: Adopt __same_type() and __must_be_array() from the kernel Arnaldo Carvalho de Melo
` (25 subsequent siblings)
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:16 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
With just what we will need in the upcoming changesets, the
BUILD_BUG_ON_ZERO() definition.
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-lw8zg7x6ttwcvqhp90mwe3vo@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/include/linux/bug.h | 10 ++++++++++
tools/perf/MANIFEST | 1 +
2 files changed, 11 insertions(+)
create mode 100644 tools/include/linux/bug.h
diff --git a/tools/include/linux/bug.h b/tools/include/linux/bug.h
new file mode 100644
index 000000000000..8e4a4f49135d
--- /dev/null
+++ b/tools/include/linux/bug.h
@@ -0,0 +1,10 @@
+#ifndef _TOOLS_PERF_LINUX_BUG_H
+#define _TOOLS_PERF_LINUX_BUG_H
+
+/* Force a compilation error if condition is true, but also produce a
+ result (of value 0 and type size_t), so the expression can be used
+ e.g. in a structure initializer (or where-ever else comma expressions
+ aren't permitted). */
+#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
+
+#endif /* _TOOLS_PERF_LINUX_BUG_H */
diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
index 89018c7311a4..a29da46d180f 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -64,6 +64,7 @@ tools/include/linux/bitops.h
tools/include/linux/compiler.h
tools/include/linux/compiler-gcc.h
tools/include/linux/coresight-pmu.h
+tools/include/linux/bug.h
tools/include/linux/filter.h
tools/include/linux/hash.h
tools/include/linux/kernel.h
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 04/28] tools include: Adopt __same_type() and __must_be_array() from the kernel
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
` (2 preceding siblings ...)
2017-04-19 16:16 ` [PATCH 03/28] tools include: Introduce linux/bug.h, from the kernel sources Arnaldo Carvalho de Melo
@ 2017-04-19 16:16 ` Arnaldo Carvalho de Melo
2017-04-19 16:17 ` [PATCH 05/28] tools include: Move ARRAY_SIZE() to linux/kernel.h Arnaldo Carvalho de Melo
` (24 subsequent siblings)
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:16 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Will be used to adopt the more stringent version of ARRAY_SIZE(), the
one in the kernel sources.
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-d85dpvay1hoqscpezlntyd8x@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/include/linux/compiler-gcc.h | 3 +++
tools/include/linux/compiler.h | 5 +++++
2 files changed, 8 insertions(+)
diff --git a/tools/include/linux/compiler-gcc.h b/tools/include/linux/compiler-gcc.h
index 616935f1ff56..825d44f89a29 100644
--- a/tools/include/linux/compiler-gcc.h
+++ b/tools/include/linux/compiler-gcc.h
@@ -16,3 +16,6 @@
#if GCC_VERSION >= 40300
# define __compiletime_error(message) __attribute__((error(message)))
#endif /* GCC_VERSION >= 40300 */
+
+/* &a[0] degrades to a pointer: a different type from an array */
+#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
diff --git a/tools/include/linux/compiler.h b/tools/include/linux/compiler.h
index c9e65e8faacd..23299d7e7160 100644
--- a/tools/include/linux/compiler.h
+++ b/tools/include/linux/compiler.h
@@ -17,6 +17,11 @@
# define __always_inline inline __attribute__((always_inline))
#endif
+/* Are two types/vars the same type (ignoring qualifiers)? */
+#ifndef __same_type
+# define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
+#endif
+
#ifdef __ANDROID__
/*
* FIXME: Big hammer to get rid of tons of:
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 05/28] tools include: Move ARRAY_SIZE() to linux/kernel.h
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
` (3 preceding siblings ...)
2017-04-19 16:16 ` [PATCH 04/28] tools include: Adopt __same_type() and __must_be_array() from the kernel Arnaldo Carvalho de Melo
@ 2017-04-19 16:17 ` Arnaldo Carvalho de Melo
2017-04-19 16:17 ` [PATCH 06/28] perf tools: Add include <linux/kernel.h> where ARRAY_SIZE() is used Arnaldo Carvalho de Melo
` (23 subsequent siblings)
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To match the kernel, then look for places redefining it to make it use
this version, which checks that its parameter is an array at build time.
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-txlcf1im83bcbj6kh0wxmyy8@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/include/linux/kernel.h | 3 +++
tools/perf/util/util.h | 2 --
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/include/linux/kernel.h b/tools/include/linux/kernel.h
index adb4d0147755..73ccc48126bb 100644
--- a/tools/include/linux/kernel.h
+++ b/tools/include/linux/kernel.h
@@ -4,6 +4,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <assert.h>
+#include <linux/compiler.h>
#ifndef UINT_MAX
#define UINT_MAX (~0U)
@@ -76,6 +77,8 @@
int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
int scnprintf(char * buf, size_t size, const char * fmt, ...);
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
+
/*
* This looks more complex than it should be. But we need to
* get the type for the ~ right in round_down (it needs to be
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index df13658377e4..3eccd6f21d17 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -1,8 +1,6 @@
#ifndef GIT_COMPAT_UTIL_H
#define GIT_COMPAT_UTIL_H
-#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
-
#ifdef __GNUC__
#define TYPEOF(x) (__typeof__(x))
#else
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 06/28] perf tools: Add include <linux/kernel.h> where ARRAY_SIZE() is used
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
` (4 preceding siblings ...)
2017-04-19 16:17 ` [PATCH 05/28] tools include: Move ARRAY_SIZE() to linux/kernel.h Arnaldo Carvalho de Melo
@ 2017-04-19 16:17 ` Arnaldo Carvalho de Melo
2017-04-19 16:17 ` [PATCH 07/28] objtool: Drop ARRAY_SIZE() definition, tools/include/linux/kernel.h has it now Arnaldo Carvalho de Melo
` (22 subsequent siblings)
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To pave the way for further cleanups where linux/kernel.h may stop being
included in some header.
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-qqxan6tfsl6qx3l0v3nwgjvk@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/bench/numa.c | 1 +
tools/perf/builtin-help.c | 1 +
tools/perf/builtin-kmem.c | 1 +
tools/perf/builtin-kvm.c | 1 +
tools/perf/builtin-lock.c | 1 +
tools/perf/builtin-sched.c | 1 +
tools/perf/builtin-script.c | 1 +
tools/perf/builtin-timechart.c | 1 +
tools/perf/builtin-trace.c | 1 +
tools/perf/perf.c | 1 +
tools/perf/tests/bpf.c | 1 +
tools/perf/tests/builtin-test.c | 1 +
tools/perf/tests/clang.c | 1 +
tools/perf/tests/code-reading.c | 1 +
tools/perf/tests/dso-data.c | 1 +
tools/perf/tests/evsel-roundtrip-name.c | 1 +
tools/perf/tests/hists_common.c | 1 +
tools/perf/tests/hists_cumulate.c | 1 +
tools/perf/tests/hists_filter.c | 1 +
tools/perf/tests/hists_link.c | 1 +
tools/perf/tests/hists_output.c | 1 +
tools/perf/tests/is_printable_array.c | 1 +
tools/perf/tests/mmap-basic.c | 1 +
tools/perf/tests/parse-events.c | 2 +-
tools/perf/tests/parse-no-sample-id-all.c | 1 +
tools/perf/tests/pmu.c | 1 +
tools/perf/tests/sample-parsing.c | 1 +
tools/perf/ui/browsers/annotate.c | 1 +
tools/perf/ui/tui/setup.c | 1 +
tools/perf/util/annotate.c | 1 +
tools/perf/util/bpf-loader.c | 1 +
tools/perf/util/data-convert-bt.c | 1 +
tools/perf/util/dso.c | 1 +
tools/perf/util/dwarf-regs.c | 1 +
tools/perf/util/event.c | 1 +
tools/perf/util/evlist.h | 1 +
tools/perf/util/mem-events.c | 1 +
tools/perf/util/perf-hooks.c | 1 +
tools/perf/util/session.h | 1 +
tools/perf/util/sort.c | 1 +
tools/perf/util/symbol.c | 1 +
tools/perf/util/thread.c | 1 +
42 files changed, 42 insertions(+), 1 deletion(-)
diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
index 1fe43bd5a012..27ebd50ee619 100644
--- a/tools/perf/bench/numa.c
+++ b/tools/perf/bench/numa.c
@@ -30,6 +30,7 @@
#include <sys/wait.h>
#include <sys/prctl.h>
#include <sys/types.h>
+#include <linux/kernel.h>
#include <linux/time64.h>
#include <numa.h>
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index 9730fd409f3b..1f18385907f5 100644
--- a/tools/perf/builtin-help.c
+++ b/tools/perf/builtin-help.c
@@ -12,6 +12,7 @@
#include <subcmd/run-command.h>
#include <subcmd/help.h>
#include "util/debug.h"
+#include <linux/kernel.h>
static struct man_viewer_list {
struct man_viewer_list *next;
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index 515587825af4..8f0b94563936 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -20,6 +20,7 @@
#include "util/debug.h"
+#include <linux/kernel.h>
#include <linux/rbtree.h>
#include <linux/string.h>
#include <locale.h>
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 38b409173693..a7d7f4c6052e 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -24,6 +24,7 @@
#include <sys/timerfd.h>
#endif
+#include <linux/kernel.h>
#include <linux/time64.h>
#include <termios.h>
#include <semaphore.h>
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index b686fb6759da..f74dd869f88b 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -26,6 +26,7 @@
#include <linux/list.h>
#include <linux/hash.h>
+#include <linux/kernel.h>
static struct perf_session *session;
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 79833e226789..5cd60882c8d9 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -22,6 +22,7 @@
#include "util/debug.h"
+#include <linux/kernel.h>
#include <linux/log2.h>
#include <sys/prctl.h>
#include <sys/resource.h>
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 2dab70fba2ba..36b076653d16 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -24,6 +24,7 @@
#include "util/thread-stack.h"
#include "util/time-utils.h"
#include <linux/bitmap.h>
+#include <linux/kernel.h>
#include <linux/stringify.h>
#include <linux/time64.h>
#include "asm/bug.h"
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index fafdb44b8bcb..822c8d39ca1d 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -23,6 +23,7 @@
#include "util/cache.h"
#include "util/evlist.h"
#include "util/evsel.h"
+#include <linux/kernel.h>
#include <linux/rbtree.h>
#include <linux/time64.h>
#include "util/symbol.h"
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index fce278d5fada..2792ed1fae43 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -45,6 +45,7 @@
#include <linux/err.h>
#include <linux/filter.h>
#include <linux/audit.h>
+#include <linux/kernel.h>
#include <linux/random.h>
#include <linux/stringify.h>
#include <linux/time64.h>
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 9dc346f2b255..07ee1352f4ed 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -22,6 +22,7 @@
#include <pthread.h>
#include <stdlib.h>
#include <time.h>
+#include <linux/kernel.h>
const char perf_usage_string[] =
"perf [--version] [--help] [OPTIONS] COMMAND [ARGS]";
diff --git a/tools/perf/tests/bpf.c b/tools/perf/tests/bpf.c
index 1a04fe77487d..67fe5eeff021 100644
--- a/tools/perf/tests/bpf.c
+++ b/tools/perf/tests/bpf.c
@@ -5,6 +5,7 @@
#include <util/evlist.h>
#include <linux/bpf.h>
#include <linux/filter.h>
+#include <linux/kernel.h>
#include <api/fs/fs.h>
#include <bpf/bpf.h>
#include "tests.h"
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index e6d7876c94c2..f029737ad255 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -13,6 +13,7 @@
#include "color.h"
#include <subcmd/parse-options.h>
#include "symbol.h"
+#include <linux/kernel.h>
static bool dont_fork;
diff --git a/tools/perf/tests/clang.c b/tools/perf/tests/clang.c
index f853e242a86c..c5bb2203f5a9 100644
--- a/tools/perf/tests/clang.c
+++ b/tools/perf/tests/clang.c
@@ -2,6 +2,7 @@
#include "debug.h"
#include "util.h"
#include "c++/clang-c.h"
+#include <linux/kernel.h>
static struct {
int (*func)(void);
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index d1f693041324..99dbd5ae294a 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -1,3 +1,4 @@
+#include <linux/kernel.h>
#include <linux/types.h>
#include <stdlib.h>
#include <unistd.h>
diff --git a/tools/perf/tests/dso-data.c b/tools/perf/tests/dso-data.c
index 13725e09ba22..46ea2e061b86 100644
--- a/tools/perf/tests/dso-data.c
+++ b/tools/perf/tests/dso-data.c
@@ -1,4 +1,5 @@
#include <stdlib.h>
+#include <linux/kernel.h>
#include <linux/types.h>
#include <sys/stat.h>
#include <fcntl.h>
diff --git a/tools/perf/tests/evsel-roundtrip-name.c b/tools/perf/tests/evsel-roundtrip-name.c
index 60926a1f6fd7..9221d2732cc4 100644
--- a/tools/perf/tests/evsel-roundtrip-name.c
+++ b/tools/perf/tests/evsel-roundtrip-name.c
@@ -3,6 +3,7 @@
#include "parse-events.h"
#include "tests.h"
#include "debug.h"
+#include <linux/kernel.h>
static int perf_evsel__roundtrip_cache_name_test(void)
{
diff --git a/tools/perf/tests/hists_common.c b/tools/perf/tests/hists_common.c
index 6b21746d6eec..f6c580e3ed84 100644
--- a/tools/perf/tests/hists_common.c
+++ b/tools/perf/tests/hists_common.c
@@ -7,6 +7,7 @@
#include "util/machine.h"
#include "util/thread.h"
#include "tests/hists_common.h"
+#include <linux/kernel.h>
static struct {
u32 pid;
diff --git a/tools/perf/tests/hists_cumulate.c b/tools/perf/tests/hists_cumulate.c
index 9fd54b79a788..70918b986568 100644
--- a/tools/perf/tests/hists_cumulate.c
+++ b/tools/perf/tests/hists_cumulate.c
@@ -9,6 +9,7 @@
#include "util/parse-events.h"
#include "tests/tests.h"
#include "tests/hists_common.h"
+#include <linux/kernel.h>
struct sample {
u32 pid;
diff --git a/tools/perf/tests/hists_filter.c b/tools/perf/tests/hists_filter.c
index 62efb14f3a5a..f171b2da4899 100644
--- a/tools/perf/tests/hists_filter.c
+++ b/tools/perf/tests/hists_filter.c
@@ -9,6 +9,7 @@
#include "util/parse-events.h"
#include "tests/tests.h"
#include "tests/hists_common.h"
+#include <linux/kernel.h>
struct sample {
u32 pid;
diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c
index eddc7407ff8a..1bd26d23c2fc 100644
--- a/tools/perf/tests/hists_link.c
+++ b/tools/perf/tests/hists_link.c
@@ -9,6 +9,7 @@
#include "thread.h"
#include "parse-events.h"
#include "hists_common.h"
+#include <linux/kernel.h>
struct sample {
u32 pid;
diff --git a/tools/perf/tests/hists_output.c b/tools/perf/tests/hists_output.c
index 63c5efaba1b5..cdf0dde5fe97 100644
--- a/tools/perf/tests/hists_output.c
+++ b/tools/perf/tests/hists_output.c
@@ -9,6 +9,7 @@
#include "util/parse-events.h"
#include "tests/tests.h"
#include "tests/hists_common.h"
+#include <linux/kernel.h>
struct sample {
u32 cpu;
diff --git a/tools/perf/tests/is_printable_array.c b/tools/perf/tests/is_printable_array.c
index 42e13393e502..a008e5c2d980 100644
--- a/tools/perf/tests/is_printable_array.c
+++ b/tools/perf/tests/is_printable_array.c
@@ -1,4 +1,5 @@
#include <linux/compiler.h>
+#include <linux/kernel.h>
#include "tests.h"
#include "debug.h"
#include "util.h"
diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c
index 634bce9caebd..a7cb80805993 100644
--- a/tools/perf/tests/mmap-basic.c
+++ b/tools/perf/tests/mmap-basic.c
@@ -7,6 +7,7 @@
#include "cpumap.h"
#include "tests.h"
#include <linux/err.h>
+#include <linux/kernel.h>
/*
* This test will generate random numbers of calls to some getpid syscalls,
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 1dc838014422..05621748aead 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -1,4 +1,3 @@
-
#include "parse-events.h"
#include "evsel.h"
#include "evlist.h"
@@ -6,6 +5,7 @@
#include "tests.h"
#include "debug.h"
#include "util.h"
+#include <linux/kernel.h>
#include <linux/hw_breakpoint.h>
#include <api/fs/fs.h>
diff --git a/tools/perf/tests/parse-no-sample-id-all.c b/tools/perf/tests/parse-no-sample-id-all.c
index 65dcf48a92fb..c6207db09f12 100644
--- a/tools/perf/tests/parse-no-sample-id-all.c
+++ b/tools/perf/tests/parse-no-sample-id-all.c
@@ -1,3 +1,4 @@
+#include <linux/kernel.h>
#include <linux/types.h>
#include <stddef.h>
diff --git a/tools/perf/tests/pmu.c b/tools/perf/tests/pmu.c
index 1e2ba2602930..de6498dc4cbb 100644
--- a/tools/perf/tests/pmu.c
+++ b/tools/perf/tests/pmu.c
@@ -2,6 +2,7 @@
#include "pmu.h"
#include "util.h"
#include "tests.h"
+#include <linux/kernel.h>
/* Simulated format definitions. */
static struct test_format {
diff --git a/tools/perf/tests/sample-parsing.c b/tools/perf/tests/sample-parsing.c
index 5f23710b9fee..73b5e47ef20b 100644
--- a/tools/perf/tests/sample-parsing.c
+++ b/tools/perf/tests/sample-parsing.c
@@ -1,4 +1,5 @@
#include <stdbool.h>
+#include <linux/kernel.h>
#include <linux/types.h>
#include "util.h"
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index ba36aac340bc..9adce112d255 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -10,6 +10,7 @@
#include "../../util/evsel.h"
#include "../../util/config.h"
#include <pthread.h>
+#include <linux/kernel.h>
struct disasm_line_samples {
double percent;
diff --git a/tools/perf/ui/tui/setup.c b/tools/perf/ui/tui/setup.c
index 4ea2ba861fc2..d9350a1da48b 100644
--- a/tools/perf/ui/tui/setup.c
+++ b/tools/perf/ui/tui/setup.c
@@ -1,6 +1,7 @@
#include <errno.h>
#include <signal.h>
#include <stdbool.h>
+#include <linux/kernel.h>
#ifdef HAVE_BACKTRACE_SUPPORT
#include <execinfo.h>
#endif
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 30498a2d4a6f..45df4a38811a 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -22,6 +22,7 @@
#include <regex.h>
#include <pthread.h>
#include <linux/bitops.h>
+#include <linux/kernel.h>
#include <sys/utsname.h>
const char *disassembler_style;
diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
index bc6bc7062eb4..27af9d62d899 100644
--- a/tools/perf/util/bpf-loader.c
+++ b/tools/perf/util/bpf-loader.c
@@ -9,6 +9,7 @@
#include <bpf/libbpf.h>
#include <bpf/bpf.h>
#include <linux/err.h>
+#include <linux/kernel.h>
#include <linux/string.h>
#include "perf.h"
#include "debug.h"
diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c
index 89ece2445713..b7917519f6cc 100644
--- a/tools/perf/util/data-convert-bt.c
+++ b/tools/perf/util/data-convert-bt.c
@@ -8,6 +8,7 @@
*/
#include <linux/compiler.h>
+#include <linux/kernel.h>
#include <babeltrace/ctf-writer/writer.h>
#include <babeltrace/ctf-writer/clock.h>
#include <babeltrace/ctf-writer/stream.h>
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 42db00d78573..385c82e12473 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -1,4 +1,5 @@
#include <asm/bug.h>
+#include <linux/kernel.h>
#include <sys/time.h>
#include <sys/resource.h>
#include "symbol.h"
diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c
index 62bc4a86a970..c708395b3cb6 100644
--- a/tools/perf/util/dwarf-regs.c
+++ b/tools/perf/util/dwarf-regs.c
@@ -8,6 +8,7 @@
#include <debug.h>
#include <dwarf-regs.h>
#include <elf.h>
+#include <linux/kernel.h>
#ifndef EM_AARCH64
#define EM_AARCH64 183 /* ARM 64 bit */
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 4d7e65fa9d86..a0f59f69f46a 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -1,3 +1,4 @@
+#include <linux/kernel.h>
#include <linux/types.h>
#include <uapi/linux/mman.h> /* To get things like MAP_HUGETLB even on older libc headers */
#include <api/fs/fs.h>
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index 39942995f537..3fed4fb2e866 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -1,6 +1,7 @@
#ifndef __PERF_EVLIST_H
#define __PERF_EVLIST_H 1
+#include <linux/kernel.h>
#include <linux/refcount.h>
#include <linux/list.h>
#include <api/fd/array.h>
diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c
index 1d4ab53c60ca..c56d52f90b54 100644
--- a/tools/perf/util/mem-events.c
+++ b/tools/perf/util/mem-events.c
@@ -6,6 +6,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include <api/fs/fs.h>
+#include <linux/kernel.h>
#include "mem-events.h"
#include "debug.h"
#include "symbol.h"
diff --git a/tools/perf/util/perf-hooks.c b/tools/perf/util/perf-hooks.c
index cb368306b12b..d55092964da2 100644
--- a/tools/perf/util/perf-hooks.c
+++ b/tools/perf/util/perf-hooks.c
@@ -9,6 +9,7 @@
#include <stdlib.h>
#include <setjmp.h>
#include <linux/err.h>
+#include <linux/kernel.h>
#include "util/util.h"
#include "util/debug.h"
#include "util/perf-hooks.h"
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h
index 4bd758553450..1ffae42f76a1 100644
--- a/tools/perf/util/session.h
+++ b/tools/perf/util/session.h
@@ -9,6 +9,7 @@
#include "thread.h"
#include "data.h"
#include "ordered-events.h"
+#include <linux/kernel.h>
#include <linux/rbtree.h>
#include <linux/perf_event.h>
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 73f3ec1cf2a0..13b9af1d1b45 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -7,6 +7,7 @@
#include "evlist.h"
#include <traceevent/event-parse.h>
#include "mem-events.h"
+#include <linux/kernel.h>
regex_t parent_regex;
const char default_parent_pattern[] = "^sys_|^do_page_fault";
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 9b4d8ba22fed..619e3eb44c50 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -3,6 +3,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <linux/kernel.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index dcdb87a5d0a1..e8ce6abc5321 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -2,6 +2,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <linux/kernel.h>
#include "session.h"
#include "thread.h"
#include "thread-stack.h"
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 07/28] objtool: Drop ARRAY_SIZE() definition, tools/include/linux/kernel.h has it now
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
` (5 preceding siblings ...)
2017-04-19 16:17 ` [PATCH 06/28] perf tools: Add include <linux/kernel.h> where ARRAY_SIZE() is used Arnaldo Carvalho de Melo
@ 2017-04-19 16:17 ` Arnaldo Carvalho de Melo
2017-04-19 16:17 ` [PATCH 08/28] tools include: Drop ARRAY_SIZE() definition from linux/hashtable.h Arnaldo Carvalho de Melo
` (21 subsequent siblings)
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Josh Poimboeuf, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
And with the goodies present in the kernel.h counterpart, i.e. checking
that the parameter is an array at build time.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-roiwxwgwgld4kygn65if60wa@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/objtool/builtin-check.c | 3 +--
tools/objtool/objtool.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c
index 066086dd59a8..282a60368b14 100644
--- a/tools/objtool/builtin-check.c
+++ b/tools/objtool/builtin-check.c
@@ -36,8 +36,7 @@
#include "warn.h"
#include <linux/hashtable.h>
-
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#include <linux/kernel.h>
#define STATE_FP_SAVED 0x1
#define STATE_FP_SETUP 0x2
diff --git a/tools/objtool/objtool.c b/tools/objtool/objtool.c
index 46c326db4f46..ecc5b1b5d15d 100644
--- a/tools/objtool/objtool.c
+++ b/tools/objtool/objtool.c
@@ -31,11 +31,10 @@
#include <stdlib.h>
#include <subcmd/exec-cmd.h>
#include <subcmd/pager.h>
+#include <linux/kernel.h>
#include "builtin.h"
-#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
-
struct cmd_struct {
const char *name;
int (*fn)(int, const char **);
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 08/28] tools include: Drop ARRAY_SIZE() definition from linux/hashtable.h
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
` (6 preceding siblings ...)
2017-04-19 16:17 ` [PATCH 07/28] objtool: Drop ARRAY_SIZE() definition, tools/include/linux/kernel.h has it now Arnaldo Carvalho de Melo
@ 2017-04-19 16:17 ` Arnaldo Carvalho de Melo
2017-04-19 16:17 ` [PATCH 09/28] perf tools: Remove unused macros from util.h Arnaldo Carvalho de Melo
` (20 subsequent siblings)
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Josh Poimboeuf, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
As tools/include/linux/kernel.h has it now, with the goodies present in
the kernel.h counterpart, i.e. checking that the parameter is an array
at build time.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-v0b41ivu6z6dyugbq9ffa9ez@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/include/linux/hashtable.h | 4 ----
1 file changed, 4 deletions(-)
diff --git a/tools/include/linux/hashtable.h b/tools/include/linux/hashtable.h
index c65cc0aa2659..251eabf2a05e 100644
--- a/tools/include/linux/hashtable.h
+++ b/tools/include/linux/hashtable.h
@@ -13,10 +13,6 @@
#include <linux/hash.h>
#include <linux/log2.h>
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-#endif
-
#define DEFINE_HASHTABLE(name, bits) \
struct hlist_head name[1 << (bits)] = \
{ [0 ... ((1 << (bits)) - 1)] = HLIST_HEAD_INIT }
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 09/28] perf tools: Remove unused macros from util.h
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
` (7 preceding siblings ...)
2017-04-19 16:17 ` [PATCH 08/28] tools include: Drop ARRAY_SIZE() definition from linux/hashtable.h Arnaldo Carvalho de Melo
@ 2017-04-19 16:17 ` Arnaldo Carvalho de Melo
2017-04-19 16:17 ` [PATCH 10/28] perf tools: Including missing inttypes.h header Arnaldo Carvalho de Melo
` (19 subsequent siblings)
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
TYPEOF(), for instance, was only used by MSB() that wasn't used at all,
besides typeof() is used in many places, should be the preferred way.
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-golox8oa2w1oq28snki14z6s@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/util.h | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 3eccd6f21d17..2abd4f783ffd 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -1,18 +1,6 @@
#ifndef GIT_COMPAT_UTIL_H
#define GIT_COMPAT_UTIL_H
-#ifdef __GNUC__
-#define TYPEOF(x) (__typeof__(x))
-#else
-#define TYPEOF(x)
-#endif
-
-#define MSB(x, bits) ((x) & TYPEOF(x)(~0ULL << (sizeof(x) * 8 - (bits))))
-#define HAS_MULTI_BITS(i) ((i) & ((i) - 1)) /* checks if an integer has more than 1 bit set */
-
-/* Approximation of the length of the decimal representation of this type. */
-#define decimal_length(x) ((int)(sizeof(x) * 2.56 + 0.5) + 1)
-
#define _ALL_SOURCE 1
#define _BSD_SOURCE 1
/* glibc 2.20 deprecates _BSD_SOURCE in favour of _DEFAULT_SOURCE */
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 10/28] perf tools: Including missing inttypes.h header
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
` (8 preceding siblings ...)
2017-04-19 16:17 ` [PATCH 09/28] perf tools: Remove unused macros from util.h Arnaldo Carvalho de Melo
@ 2017-04-19 16:17 ` Arnaldo Carvalho de Melo
2017-04-19 16:17 ` [PATCH 11/28] perf tools: Remove PRI[xu] macros from perf.h Arnaldo Carvalho de Melo
` (18 subsequent siblings)
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Needed to use the PRI[xu](32,64) formatting macros.
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-wkbho8kaw24q67dd11q0j39f@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/arch/x86/tests/perf-time-to-tsc.c | 1 +
tools/perf/bench/numa.c | 1 +
tools/perf/builtin-c2c.c | 1 +
tools/perf/builtin-diff.c | 1 +
tools/perf/builtin-kallsyms.c | 1 +
tools/perf/builtin-kmem.c | 1 +
tools/perf/builtin-kvm.c | 1 +
tools/perf/builtin-lock.c | 1 +
tools/perf/builtin-mem.c | 1 +
tools/perf/builtin-record.c | 1 +
tools/perf/builtin-report.c | 1 +
tools/perf/builtin-sched.c | 1 +
tools/perf/builtin-script.c | 1 +
tools/perf/builtin-stat.c | 1 +
tools/perf/builtin-timechart.c | 1 +
tools/perf/builtin-trace.c | 1 +
tools/perf/tests/attr.c | 1 +
tools/perf/tests/code-reading.c | 1 +
tools/perf/tests/dwarf-unwind.c | 1 +
tools/perf/tests/event-times.c | 1 +
tools/perf/tests/hists_common.c | 1 +
tools/perf/tests/mmap-basic.c | 1 +
tools/perf/tests/mmap-thread-lookup.c | 1 +
tools/perf/tests/openat-syscall-all-cpus.c | 1 +
tools/perf/tests/openat-syscall.c | 1 +
tools/perf/tests/perf-record.c | 1 +
tools/perf/tests/sample-parsing.c | 1 +
tools/perf/tests/sw-clock.c | 1 +
tools/perf/tests/unit_number__scnprintf.c | 1 +
tools/perf/tests/vmlinux-kallsyms.c | 1 +
tools/perf/ui/browsers/annotate.c | 1 +
tools/perf/ui/browsers/hists.c | 1 +
tools/perf/ui/gtk/annotate.c | 2 +-
tools/perf/ui/hist.c | 1 +
tools/perf/util/annotate.c | 1 +
tools/perf/util/auxtrace.c | 1 +
tools/perf/util/callchain.c | 1 +
tools/perf/util/data-convert-bt.c | 1 +
tools/perf/util/debug.c | 1 +
tools/perf/util/dwarf-aux.c | 1 +
tools/perf/util/event.c | 1 +
tools/perf/util/evlist.c | 1 +
tools/perf/util/evsel.c | 1 +
tools/perf/util/evsel_fprintf.c | 1 +
| 1 +
tools/perf/util/intel-bts.c | 1 +
tools/perf/util/intel-pt.c | 1 +
tools/perf/util/machine.c | 1 +
tools/perf/util/ordered-events.c | 1 +
tools/perf/util/probe-event.c | 1 +
tools/perf/util/probe-finder.c | 1 +
tools/perf/util/scripting-engines/trace-event-perl.c | 1 +
tools/perf/util/scripting-engines/trace-event-python.c | 1 +
tools/perf/util/session.c | 1 +
tools/perf/util/sort.c | 1 +
tools/perf/util/srcline.c | 1 +
tools/perf/util/stat.c | 1 +
tools/perf/util/unwind-libunwind-local.c | 1 +
tools/perf/util/util.c | 1 +
59 files changed, 59 insertions(+), 1 deletion(-)
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 5c76cc83186a..a8e37f3148c2 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 @@
+#include <inttypes.h>
#include <stdio.h>
#include <unistd.h>
#include <linux/types.h>
diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
index 27ebd50ee619..27de0c8c5c19 100644
--- a/tools/perf/bench/numa.c
+++ b/tools/perf/bench/numa.c
@@ -4,6 +4,7 @@
* numa: Simulate NUMA-sensitive workload and measure their NUMA performance
*/
+#include <inttypes.h>
/* For the CLR_() macros */
#include <pthread.h>
diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index 70c2c773a2b8..cc8156a969ac 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -9,6 +9,7 @@
* Dick Fowles <fowles@inreach.com>
* Joe Mario <jmario@redhat.com>
*/
+#include <inttypes.h>
#include <linux/compiler.h>
#include <linux/kernel.h>
#include <linux/stringify.h>
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index cd2605d86984..09be77b13788 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -19,6 +19,7 @@
#include "util/data.h"
#include "util/config.h"
+#include <inttypes.h>
#include <stdlib.h>
#include <math.h>
diff --git a/tools/perf/builtin-kallsyms.c b/tools/perf/builtin-kallsyms.c
index 8ff38c4eb2c0..bcfb363112d3 100644
--- a/tools/perf/builtin-kallsyms.c
+++ b/tools/perf/builtin-kallsyms.c
@@ -7,6 +7,7 @@
*
* Released under the GPL v2. (and only v2, not any later version)
*/
+#include <inttypes.h>
#include "builtin.h"
#include <linux/compiler.h>
#include <subcmd/parse-options.h>
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index 8f0b94563936..fa6bf1c39b65 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -23,6 +23,7 @@
#include <linux/kernel.h>
#include <linux/rbtree.h>
#include <linux/string.h>
+#include <inttypes.h>
#include <locale.h>
#include <regex.h>
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index a7d7f4c6052e..e82a6979327f 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -26,6 +26,7 @@
#include <linux/kernel.h>
#include <linux/time64.h>
+#include <inttypes.h>
#include <termios.h>
#include <semaphore.h>
#include <pthread.h>
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index f74dd869f88b..6f93a6f0e268 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -1,3 +1,4 @@
+#include <inttypes.h>
#include "builtin.h"
#include "perf.h"
diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c
index 643f4faac0d0..1ebc67390898 100644
--- a/tools/perf/builtin-mem.c
+++ b/tools/perf/builtin-mem.c
@@ -1,3 +1,4 @@
+#include <inttypes.h>
#include "builtin.h"
#include "perf.h"
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 3191ab063852..65429d1b29c8 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -40,6 +40,7 @@
#include "util/perf-hooks.h"
#include "asm/bug.h"
+#include <inttypes.h>
#include <unistd.h>
#include <sched.h>
#include <sys/mman.h>
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index c18158b83eb1..66a2f44518de 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -40,6 +40,7 @@
#include "util/auxtrace.h"
#include <dlfcn.h>
+#include <inttypes.h>
#include <linux/bitmap.h>
#include <linux/stringify.h>
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 5cd60882c8d9..d4677fb7f7f5 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -26,6 +26,7 @@
#include <linux/log2.h>
#include <sys/prctl.h>
#include <sys/resource.h>
+#include <inttypes.h>
#include <semaphore.h>
#include <pthread.h>
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 36b076653d16..c4e36b4743f4 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -30,6 +30,7 @@
#include "asm/bug.h"
#include "util/mem-events.h"
#include "util/dump-insn.h"
+#include <inttypes.h>
static char const *script_name;
static char const *generate_script_lang;
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 610225b6326e..b7199f029073 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -70,6 +70,7 @@
#include <api/fs/fs.h>
#include <stdlib.h>
#include <sys/prctl.h>
+#include <inttypes.h>
#include <locale.h>
#include <math.h>
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index 822c8d39ca1d..a24b229a785f 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -12,6 +12,7 @@
* of the License.
*/
+#include <inttypes.h>
#include <traceevent/event-parse.h>
#include "builtin.h"
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 2792ed1fae43..aba5fac41529 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -39,6 +39,7 @@
#include "syscalltbl.h"
#include "rb_resort.h"
+#include <inttypes.h>
#include <libaudit.h> /* FIXME: Still needed for audit_errno_to_name */
#include <stdlib.h>
#include <string.h>
diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index 88dc51f4c27b..bb2bc487f703 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -18,6 +18,7 @@
* permissions. All the event text files are stored there.
*/
+#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <linux/types.h>
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 99dbd5ae294a..6effcfb7e0c1 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -1,5 +1,6 @@
#include <linux/kernel.h>
#include <linux/types.h>
+#include <inttypes.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
diff --git a/tools/perf/tests/dwarf-unwind.c b/tools/perf/tests/dwarf-unwind.c
index 1046491de4b2..dfe5c89e2049 100644
--- a/tools/perf/tests/dwarf-unwind.c
+++ b/tools/perf/tests/dwarf-unwind.c
@@ -1,5 +1,6 @@
#include <linux/compiler.h>
#include <linux/types.h>
+#include <inttypes.h>
#include <unistd.h>
#include "tests.h"
#include "debug.h"
diff --git a/tools/perf/tests/event-times.c b/tools/perf/tests/event-times.c
index 19ef77bd6eb4..8d376e155697 100644
--- a/tools/perf/tests/event-times.c
+++ b/tools/perf/tests/event-times.c
@@ -1,4 +1,5 @@
#include <linux/compiler.h>
+#include <inttypes.h>
#include <string.h>
#include "tests.h"
#include "evlist.h"
diff --git a/tools/perf/tests/hists_common.c b/tools/perf/tests/hists_common.c
index f6c580e3ed84..00b8dc50f3db 100644
--- a/tools/perf/tests/hists_common.c
+++ b/tools/perf/tests/hists_common.c
@@ -1,3 +1,4 @@
+#include <inttypes.h>
#include "perf.h"
#include "util/debug.h"
#include "util/symbol.h"
diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c
index a7cb80805993..aba40eb4c56f 100644
--- a/tools/perf/tests/mmap-basic.c
+++ b/tools/perf/tests/mmap-basic.c
@@ -1,3 +1,4 @@
+#include <inttypes.h>
/* For the CLR_() macros */
#include <pthread.h>
diff --git a/tools/perf/tests/mmap-thread-lookup.c b/tools/perf/tests/mmap-thread-lookup.c
index 0c5ce44f723f..a5ffb754f8c6 100644
--- a/tools/perf/tests/mmap-thread-lookup.c
+++ b/tools/perf/tests/mmap-thread-lookup.c
@@ -1,3 +1,4 @@
+#include <inttypes.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <sys/types.h>
diff --git a/tools/perf/tests/openat-syscall-all-cpus.c b/tools/perf/tests/openat-syscall-all-cpus.c
index c8d9592eb142..eb7b1a6d507e 100644
--- a/tools/perf/tests/openat-syscall-all-cpus.c
+++ b/tools/perf/tests/openat-syscall-all-cpus.c
@@ -1,3 +1,4 @@
+#include <inttypes.h>
/* For the CPU_* macros */
#include <pthread.h>
diff --git a/tools/perf/tests/openat-syscall.c b/tools/perf/tests/openat-syscall.c
index d7414128d7fe..5964938d4b85 100644
--- a/tools/perf/tests/openat-syscall.c
+++ b/tools/perf/tests/openat-syscall.c
@@ -1,3 +1,4 @@
+#include <inttypes.h>
#include <api/fs/tracing_path.h>
#include <linux/err.h>
#include "thread_map.h"
diff --git a/tools/perf/tests/perf-record.c b/tools/perf/tests/perf-record.c
index 87893f3ba5f1..a8b6fdaf8df1 100644
--- a/tools/perf/tests/perf-record.c
+++ b/tools/perf/tests/perf-record.c
@@ -1,3 +1,4 @@
+#include <inttypes.h>
/* For the CLR_() macros */
#include <pthread.h>
diff --git a/tools/perf/tests/sample-parsing.c b/tools/perf/tests/sample-parsing.c
index 73b5e47ef20b..bac5c3885b3b 100644
--- a/tools/perf/tests/sample-parsing.c
+++ b/tools/perf/tests/sample-parsing.c
@@ -1,4 +1,5 @@
#include <stdbool.h>
+#include <inttypes.h>
#include <linux/kernel.h>
#include <linux/types.h>
diff --git a/tools/perf/tests/sw-clock.c b/tools/perf/tests/sw-clock.c
index 4c9fd046d57b..29f11c4b3e60 100644
--- a/tools/perf/tests/sw-clock.c
+++ b/tools/perf/tests/sw-clock.c
@@ -1,3 +1,4 @@
+#include <inttypes.h>
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>
diff --git a/tools/perf/tests/unit_number__scnprintf.c b/tools/perf/tests/unit_number__scnprintf.c
index 623c2aa53c4a..f84cb70ee5e5 100644
--- a/tools/perf/tests/unit_number__scnprintf.c
+++ b/tools/perf/tests/unit_number__scnprintf.c
@@ -1,3 +1,4 @@
+#include <inttypes.h>
#include <linux/compiler.h>
#include <linux/types.h>
#include "tests.h"
diff --git a/tools/perf/tests/vmlinux-kallsyms.c b/tools/perf/tests/vmlinux-kallsyms.c
index 862b043e5924..8456175fc234 100644
--- a/tools/perf/tests/vmlinux-kallsyms.c
+++ b/tools/perf/tests/vmlinux-kallsyms.c
@@ -1,5 +1,6 @@
#include <linux/compiler.h>
#include <linux/rbtree.h>
+#include <inttypes.h>
#include <string.h>
#include "map.h"
#include "symbol.h"
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index 9adce112d255..2ed64124276f 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -9,6 +9,7 @@
#include "../../util/symbol.h"
#include "../../util/evsel.h"
#include "../../util/config.h"
+#include <inttypes.h>
#include <pthread.h>
#include <linux/kernel.h>
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index da24072bb76e..a2ea1fa15ae6 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1,3 +1,4 @@
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tools/perf/ui/gtk/annotate.c b/tools/perf/ui/gtk/annotate.c
index 8c9308ac30b7..71359b898b67 100644
--- a/tools/perf/ui/gtk/annotate.c
+++ b/tools/perf/ui/gtk/annotate.c
@@ -3,7 +3,7 @@
#include "util/annotate.h"
#include "util/evsel.h"
#include "ui/helpline.h"
-
+#include <inttypes.h>
enum {
ANN_COL__PERCENT,
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 5d632dca672a..59addd52d9cd 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -1,3 +1,4 @@
+#include <inttypes.h>
#include <math.h>
#include <linux/compiler.h>
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 45df4a38811a..4d4faf99d52d 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -7,6 +7,7 @@
* Released under the GPL v2. (and only v2, not any later version)
*/
+#include <inttypes.h>
#include "util.h"
#include "ui/ui.h"
#include "sort.h"
diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c
index 78bd632f144d..a81a402a7459 100644
--- a/tools/perf/util/auxtrace.c
+++ b/tools/perf/util/auxtrace.c
@@ -13,6 +13,7 @@
*
*/
+#include <inttypes.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <stdbool.h>
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 2e5eff5abef0..0096d45a06b3 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -9,6 +9,7 @@
*
*/
+#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c
index b7917519f6cc..ef80221e0d9c 100644
--- a/tools/perf/util/data-convert-bt.c
+++ b/tools/perf/util/data-convert-bt.c
@@ -7,6 +7,7 @@
* Released under the GPL v2. (and only v2, not any later version)
*/
+#include <inttypes.h>
#include <linux/compiler.h>
#include <linux/kernel.h>
#include <babeltrace/ctf-writer/writer.h>
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c
index 03eb81f30d0d..4d5df25f155a 100644
--- a/tools/perf/util/debug.c
+++ b/tools/perf/util/debug.c
@@ -2,6 +2,7 @@
#include "../perf.h"
+#include <inttypes.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c
index 41e068e94349..5fb186d142f6 100644
--- a/tools/perf/util/dwarf-aux.c
+++ b/tools/perf/util/dwarf-aux.c
@@ -17,6 +17,7 @@
*
*/
+#include <inttypes.h>
#include <stdbool.h>
#include "util.h"
#include "debug.h"
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index a0f59f69f46a..b761b0eb60af 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -1,3 +1,4 @@
+#include <inttypes.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <uapi/linux/mman.h> /* To get things like MAP_HUGETLB even on older libc headers */
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 50420cd35446..cf27039df100 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -8,6 +8,7 @@
*/
#include "util.h"
#include <api/fs/fs.h>
+#include <inttypes.h>
#include <poll.h>
#include "cpumap.h"
#include "thread_map.h"
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 3779b9f3f134..99a13a63ff1f 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -8,6 +8,7 @@
*/
#include <byteswap.h>
+#include <inttypes.h>
#include <linux/bitops.h>
#include <api/fs/tracing_path.h>
#include <traceevent/event-parse.h>
diff --git a/tools/perf/util/evsel_fprintf.c b/tools/perf/util/evsel_fprintf.c
index 4ef5184819a0..8000f62d5d53 100644
--- a/tools/perf/util/evsel_fprintf.c
+++ b/tools/perf/util/evsel_fprintf.c
@@ -1,3 +1,4 @@
+#include <inttypes.h>
#include <stdio.h>
#include <stdbool.h>
#include <traceevent/event-parse.h>
--git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 2ccc7f06db79..0371f3483ede 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -1,3 +1,4 @@
+#include <inttypes.h>
#include "util.h"
#include <sys/types.h>
#include <byteswap.h>
diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c
index 6c2eb5da4afc..471ed8b26a1c 100644
--- a/tools/perf/util/intel-bts.c
+++ b/tools/perf/util/intel-bts.c
@@ -15,6 +15,7 @@
#include <endian.h>
#include <byteswap.h>
+#include <inttypes.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/bitops.h>
diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
index da20cd5612e9..bdd4a28c6cee 100644
--- a/tools/perf/util/intel-pt.c
+++ b/tools/perf/util/intel-pt.c
@@ -13,6 +13,7 @@
*
*/
+#include <inttypes.h>
#include <stdio.h>
#include <stdbool.h>
#include <errno.h>
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index dfc600446586..15b2a17cf76e 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1,3 +1,4 @@
+#include <inttypes.h>
#include "callchain.h"
#include "debug.h"
#include "event.h"
diff --git a/tools/perf/util/ordered-events.c b/tools/perf/util/ordered-events.c
index e70e935b1841..df05be69cc9e 100644
--- a/tools/perf/util/ordered-events.c
+++ b/tools/perf/util/ordered-events.c
@@ -1,3 +1,4 @@
+#include <inttypes.h>
#include <linux/list.h>
#include <linux/compiler.h>
#include <linux/string.h>
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index e4b889444447..e61b4b34a929 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -19,6 +19,7 @@
*
*/
+#include <inttypes.h>
#include <sys/utsname.h>
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 57cd268d4275..9ddd7dad2e6e 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -19,6 +19,7 @@
*
*/
+#include <inttypes.h>
#include <sys/utsname.h>
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c
index dff043a29589..2b12bdb3ce33 100644
--- a/tools/perf/util/scripting-engines/trace-event-perl.c
+++ b/tools/perf/util/scripting-engines/trace-event-perl.c
@@ -19,6 +19,7 @@
*
*/
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index 783326cfbaa6..dd61213e7a3c 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -21,6 +21,7 @@
#include <Python.h>
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 7b740a73e595..0695e08d2252 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1,3 +1,4 @@
+#include <inttypes.h>
#include <linux/kernel.h>
#include <traceevent/event-parse.h>
#include <api/fs/fs.h>
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 13b9af1d1b45..63ad5374f364 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1,3 +1,4 @@
+#include <inttypes.h>
#include <sys/mman.h>
#include "sort.h"
#include "hist.h"
diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c
index 778ccb5d99d1..ef192802edc9 100644
--- a/tools/perf/util/srcline.c
+++ b/tools/perf/util/srcline.c
@@ -1,3 +1,4 @@
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
index 0d51334a9b46..bbf30b2d1614 100644
--- a/tools/perf/util/stat.c
+++ b/tools/perf/util/stat.c
@@ -1,3 +1,4 @@
+#include <inttypes.h>
#include <math.h>
#include "stat.h"
#include "evlist.h"
diff --git a/tools/perf/util/unwind-libunwind-local.c b/tools/perf/util/unwind-libunwind-local.c
index bfb9b7987692..788f4d3c76f5 100644
--- a/tools/perf/util/unwind-libunwind-local.c
+++ b/tools/perf/util/unwind-libunwind-local.c
@@ -18,6 +18,7 @@
#include <elf.h>
#include <gelf.h>
#include <fcntl.h>
+#include <inttypes.h>
#include <string.h>
#include <unistd.h>
#include <sys/mman.h>
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 6097d87429e2..524bd3b9d98d 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -7,6 +7,7 @@
#ifdef HAVE_BACKTRACE_SUPPORT
#include <execinfo.h>
#endif
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 11/28] perf tools: Remove PRI[xu] macros from perf.h
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
` (9 preceding siblings ...)
2017-04-19 16:17 ` [PATCH 10/28] perf tools: Including missing inttypes.h header Arnaldo Carvalho de Melo
@ 2017-04-19 16:17 ` Arnaldo Carvalho de Melo
2017-04-19 16:17 ` [PATCH 12/28] perf tools: Replace STR() calls with __stringify() Arnaldo Carvalho de Melo
` (17 subsequent siblings)
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
We get them from inttypes.h.
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-qla4e4mwbf1oewafp1ee2etd@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/util.h | 20 --------------------
1 file changed, 20 deletions(-)
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 2abd4f783ffd..593a24192924 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -34,7 +34,6 @@
#include <poll.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
-#include <inttypes.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <sys/ttydefaults.h>
@@ -50,25 +49,6 @@ extern const char *spaces;
extern const char *dots;
extern char buildid_dir[];
-/* On most systems <limits.h> would have given us this, but
- * not on some systems (e.g. GNU/Hurd).
- */
-#ifndef PATH_MAX
-#define PATH_MAX 4096
-#endif
-
-#ifndef PRIuMAX
-#define PRIuMAX "llu"
-#endif
-
-#ifndef PRIu32
-#define PRIu32 "u"
-#endif
-
-#ifndef PRIx32
-#define PRIx32 "x"
-#endif
-
#ifndef PATH_SEP
#define PATH_SEP ':'
#endif
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 12/28] perf tools: Replace STR() calls with __stringify()
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
` (10 preceding siblings ...)
2017-04-19 16:17 ` [PATCH 11/28] perf tools: Remove PRI[xu] macros from perf.h Arnaldo Carvalho de Melo
@ 2017-04-19 16:17 ` Arnaldo Carvalho de Melo
2017-04-19 16:17 ` [PATCH 13/28] perf tools: Ditch unused PATH_SEP, STRIP_EXTENSION Arnaldo Carvalho de Melo
` (16 subsequent siblings)
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Both do the same thing, the later is the one we get from
linux/stringify.h, i.e. we now use the same function name/practice as
the kernel sources.
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-w2sxa5o4bfx7fjrd5mu4zmke@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/arch/arm/util/dwarf-regs.c | 4 ++--
tools/perf/arch/arm64/util/dwarf-regs.c | 3 ++-
tools/perf/arch/powerpc/util/dwarf-regs.c | 5 +++--
tools/perf/util/cgroup.c | 5 +++--
tools/perf/util/jitdump.c | 3 ++-
tools/perf/util/util.h | 3 ---
6 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/tools/perf/arch/arm/util/dwarf-regs.c b/tools/perf/arch/arm/util/dwarf-regs.c
index 33ec5b339da8..8bb176a37990 100644
--- a/tools/perf/arch/arm/util/dwarf-regs.c
+++ b/tools/perf/arch/arm/util/dwarf-regs.c
@@ -9,6 +9,7 @@
*/
#include <stddef.h>
+#include <linux/stringify.h>
#include <dwarf-regs.h>
struct pt_regs_dwarfnum {
@@ -16,10 +17,9 @@ struct pt_regs_dwarfnum {
unsigned int dwarfnum;
};
-#define STR(s) #s
#define REG_DWARFNUM_NAME(r, num) {.name = r, .dwarfnum = num}
#define GPR_DWARFNUM_NAME(num) \
- {.name = STR(%r##num), .dwarfnum = num}
+ {.name = __stringify(%r##num), .dwarfnum = num}
#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0}
/*
diff --git a/tools/perf/arch/arm64/util/dwarf-regs.c b/tools/perf/arch/arm64/util/dwarf-regs.c
index 068b6189157b..aea610c292e6 100644
--- a/tools/perf/arch/arm64/util/dwarf-regs.c
+++ b/tools/perf/arch/arm64/util/dwarf-regs.c
@@ -11,6 +11,7 @@
#include <stddef.h>
#include <dwarf-regs.h>
#include <linux/ptrace.h> /* for struct user_pt_regs */
+#include <linux/stringify.h>
#include "util.h"
struct pt_regs_dwarfnum {
@@ -20,7 +21,7 @@ struct pt_regs_dwarfnum {
#define REG_DWARFNUM_NAME(r, num) {.name = r, .dwarfnum = num}
#define GPR_DWARFNUM_NAME(num) \
- {.name = STR(%x##num), .dwarfnum = num}
+ {.name = __stringify(%x##num), .dwarfnum = num}
#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0}
#define DWARFNUM2OFFSET(index) \
(index * sizeof((struct user_pt_regs *)0)->regs[0])
diff --git a/tools/perf/arch/powerpc/util/dwarf-regs.c b/tools/perf/arch/powerpc/util/dwarf-regs.c
index 41bdf9530d82..98ac87052a74 100644
--- a/tools/perf/arch/powerpc/util/dwarf-regs.c
+++ b/tools/perf/arch/powerpc/util/dwarf-regs.c
@@ -15,6 +15,7 @@
#include <dwarf-regs.h>
#include <linux/ptrace.h>
#include <linux/kernel.h>
+#include <linux/stringify.h>
#include "util.h"
struct pt_regs_dwarfnum {
@@ -24,10 +25,10 @@ struct pt_regs_dwarfnum {
};
#define REG_DWARFNUM_NAME(r, num) \
- {.name = STR(%)STR(r), .dwarfnum = num, \
+ {.name = __stringify(%)__stringify(r), .dwarfnum = num, \
.ptregs_offset = offsetof(struct pt_regs, r)}
#define GPR_DWARFNUM_NAME(num) \
- {.name = STR(%gpr##num), .dwarfnum = num, \
+ {.name = __stringify(%gpr##num), .dwarfnum = num, \
.ptregs_offset = offsetof(struct pt_regs, gpr[num])}
#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0, .ptregs_offset = 0}
diff --git a/tools/perf/util/cgroup.c b/tools/perf/util/cgroup.c
index 86399eda3684..03347748f3fa 100644
--- a/tools/perf/util/cgroup.c
+++ b/tools/perf/util/cgroup.c
@@ -4,6 +4,7 @@
#include "evsel.h"
#include "cgroup.h"
#include "evlist.h"
+#include <linux/stringify.h>
int nr_cgroups;
@@ -27,8 +28,8 @@ cgroupfs_find_mountpoint(char *buf, size_t maxlen)
path_v1[0] = '\0';
path_v2[0] = '\0';
- while (fscanf(fp, "%*s %"STR(PATH_MAX)"s %"STR(PATH_MAX)"s %"
- STR(PATH_MAX)"s %*d %*d\n",
+ while (fscanf(fp, "%*s %"__stringify(PATH_MAX)"s %"__stringify(PATH_MAX)"s %"
+ __stringify(PATH_MAX)"s %*d %*d\n",
mountpoint, type, tokens) == 3) {
if (!path_v1[0] && !strcmp(type, "cgroup")) {
diff --git a/tools/perf/util/jitdump.c b/tools/perf/util/jitdump.c
index c9a941ef0f6d..da6262dbe9e3 100644
--- a/tools/perf/util/jitdump.c
+++ b/tools/perf/util/jitdump.c
@@ -9,6 +9,7 @@
#include <byteswap.h>
#include <sys/stat.h>
#include <sys/mman.h>
+#include <linux/stringify.h>
#include "util.h"
#include "event.h"
@@ -181,7 +182,7 @@ jit_open(struct jit_buf_desc *jd, const char *name)
jd->use_arch_timestamp);
if (header.version > JITHEADER_VERSION) {
- pr_err("wrong jitdump version %u, expected " STR(JITHEADER_VERSION),
+ pr_err("wrong jitdump version %u, expected " __stringify(JITHEADER_VERSION),
header.version);
goto error;
}
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 593a24192924..aa35509464b5 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -180,9 +180,6 @@ struct perf_event_attr;
void event_attr_init(struct perf_event_attr *attr);
-#define _STR(x) #x
-#define STR(x) _STR(x)
-
size_t hex_width(u64 v);
int hex2u64(const char *ptr, u64 *val);
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 13/28] perf tools: Ditch unused PATH_SEP, STRIP_EXTENSION
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
` (11 preceding siblings ...)
2017-04-19 16:17 ` [PATCH 12/28] perf tools: Replace STR() calls with __stringify() Arnaldo Carvalho de Melo
@ 2017-04-19 16:17 ` Arnaldo Carvalho de Melo
2017-04-19 16:17 ` [PATCH 14/28] perf tools: Move sane ctype stuff from util.h to sane_ctype.h Arnaldo Carvalho de Melo
` (15 subsequent siblings)
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Should make sense for windows, where git is supported.
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-lzxlhmqrizk72d0zcsreggy8@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/perf.c | 10 ----------
tools/perf/util/util.h | 16 ----------------
2 files changed, 26 deletions(-)
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 07ee1352f4ed..94e9418aecb1 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -328,16 +328,6 @@ static void handle_internal_command(int argc, const char **argv)
{
const char *cmd = argv[0];
unsigned int i;
- static const char ext[] = STRIP_EXTENSION;
-
- if (sizeof(ext) > 1) {
- i = strlen(argv[0]) - strlen(ext);
- if (i > 0 && !strcmp(argv[0] + i, ext)) {
- char *argv0 = strdup(argv[0]);
- argv[0] = cmd = argv0;
- argv0[i] = '\0';
- }
- }
/* Turn "perf cmd --help" into "perf help cmd" */
if (argc > 1 && !strcmp(argv[1], "--help")) {
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index aa35509464b5..f26666d77677 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -49,22 +49,6 @@ extern const char *spaces;
extern const char *dots;
extern char buildid_dir[];
-#ifndef PATH_SEP
-#define PATH_SEP ':'
-#endif
-
-#ifndef STRIP_EXTENSION
-#define STRIP_EXTENSION ""
-#endif
-
-#ifndef has_dos_drive_prefix
-#define has_dos_drive_prefix(path) 0
-#endif
-
-#ifndef is_dir_sep
-#define is_dir_sep(c) ((c) == '/')
-#endif
-
#ifdef __GNUC__
#define NORETURN __attribute__((__noreturn__))
#else
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 14/28] perf tools: Move sane ctype stuff from util.h to sane_ctype.h
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
` (12 preceding siblings ...)
2017-04-19 16:17 ` [PATCH 13/28] perf tools: Ditch unused PATH_SEP, STRIP_EXTENSION Arnaldo Carvalho de Melo
@ 2017-04-19 16:17 ` Arnaldo Carvalho de Melo
2017-04-19 16:17 ` [PATCH 15/28] tools include: Include missing headers for fls() and types in linux/log2.h Arnaldo Carvalho de Melo
` (14 subsequent siblings)
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
More stuff that came from git, out of the hodge-podge that is util.h
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-e3lana4gctz3ub4hn4y29hkw@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/symbol/kallsyms.c | 1 +
tools/perf/arch/common.c | 2 ++
tools/perf/builtin-kmem.c | 2 ++
tools/perf/builtin-sched.c | 2 ++
tools/perf/builtin-script.c | 2 ++
tools/perf/builtin-stat.c | 2 ++
tools/perf/builtin-top.c | 2 ++
tools/perf/builtin-trace.c | 2 ++
tools/perf/tests/code-reading.c | 3 ++-
tools/perf/ui/browser.c | 1 +
tools/perf/ui/browsers/hists.c | 2 ++
tools/perf/ui/browsers/map.c | 2 ++
tools/perf/ui/stdio/hist.c | 2 +-
tools/perf/util/annotate.c | 2 ++
tools/perf/util/auxtrace.c | 5 ++--
tools/perf/util/build-id.c | 1 +
tools/perf/util/config.c | 2 ++
tools/perf/util/cpumap.c | 2 ++
tools/perf/util/ctype.c | 2 +-
tools/perf/util/data-convert-bt.c | 1 +
tools/perf/util/debug.c | 2 ++
tools/perf/util/demangle-java.c | 2 ++
tools/perf/util/event.c | 1 +
tools/perf/util/evsel.c | 2 ++
| 2 ++
tools/perf/util/jitdump.c | 2 ++
tools/perf/util/machine.c | 4 ++-
tools/perf/util/probe-event.c | 2 ++
tools/perf/util/probe-finder.h | 2 +-
tools/perf/util/sane_ctype.h | 51 +++++++++++++++++++++++++++++++++++++
tools/perf/util/strfilter.c | 2 ++
tools/perf/util/string.c | 2 ++
tools/perf/util/symbol-elf.c | 3 ++-
tools/perf/util/symbol.c | 1 +
tools/perf/util/trace-event-parse.c | 3 ++-
tools/perf/util/util.c | 2 ++
tools/perf/util/util.h | 46 ---------------------------------
37 files changed, 114 insertions(+), 55 deletions(-)
create mode 100644 tools/perf/util/sane_ctype.h
diff --git a/tools/lib/symbol/kallsyms.c b/tools/lib/symbol/kallsyms.c
index 5e431077fcd6..d270ac00613d 100644
--- a/tools/lib/symbol/kallsyms.c
+++ b/tools/lib/symbol/kallsyms.c
@@ -1,3 +1,4 @@
+#include <ctype.h>
#include "symbol/kallsyms.h"
#include <stdio.h>
#include <stdlib.h>
diff --git a/tools/perf/arch/common.c b/tools/perf/arch/common.c
index 886dd2aaff0d..837067f48a4c 100644
--- a/tools/perf/arch/common.c
+++ b/tools/perf/arch/common.c
@@ -4,6 +4,8 @@
#include "../util/util.h"
#include "../util/debug.h"
+#include "sane_ctype.h"
+
const char *const arm_triplets[] = {
"arm-eabi-",
"arm-linux-androideabi-",
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index fa6bf1c39b65..15754a492cad 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -27,6 +27,8 @@
#include <locale.h>
#include <regex.h>
+#include "sane_ctype.h"
+
static int kmem_slab;
static int kmem_page;
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index d4677fb7f7f5..aefab93d7d2f 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -34,6 +34,8 @@
#include <api/fs/fs.h>
#include <linux/time64.h>
+#include "sane_ctype.h"
+
#define PR_SET_NAME 15 /* Set process name */
#define MAX_CPUS 4096
#define COMM_LEN 20
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index c4e36b4743f4..5afd9a62360a 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -32,6 +32,8 @@
#include "util/dump-insn.h"
#include <inttypes.h>
+#include "sane_ctype.h"
+
static char const *script_name;
static char const *generate_script_lang;
static bool debug_mode;
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index b7199f029073..5abef25f9983 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -74,6 +74,8 @@
#include <locale.h>
#include <math.h>
+#include "sane_ctype.h"
+
#define DEFAULT_SEPARATOR " "
#define CNTR_NOT_SUPPORTED "<not supported>"
#define CNTR_NOT_COUNTED "<not counted>"
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index a0c97c70ec81..ec3247db4826 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -72,6 +72,8 @@
#include <linux/time64.h>
#include <linux/types.h>
+#include "sane_ctype.h"
+
static volatile int done;
#define HEADER_LINE_NR 5
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index aba5fac41529..0b00d8ac5226 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -51,6 +51,8 @@
#include <linux/stringify.h>
#include <linux/time64.h>
+#include "sane_ctype.h"
+
#ifndef O_CLOEXEC
# define O_CLOEXEC 02000000
#endif
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 6effcfb7e0c1..fe6aac82d54e 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -4,7 +4,6 @@
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
-#include <ctype.h>
#include <string.h>
#include "parse-events.h"
@@ -18,6 +17,8 @@
#include "tests.h"
+#include "sane_ctype.h"
+
#define BUFSZ 1024
#define READLEN 128
diff --git a/tools/perf/ui/browser.c b/tools/perf/ui/browser.c
index 9e47ccbe07f1..73bdd07321c4 100644
--- a/tools/perf/ui/browser.c
+++ b/tools/perf/ui/browser.c
@@ -13,6 +13,7 @@
#include "helpline.h"
#include "keysyms.h"
#include "../color.h"
+#include "sane_ctype.h"
static int ui_browser__percent_color(struct ui_browser *browser,
double percent, bool current)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index a2ea1fa15ae6..56f5c038689e 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -20,6 +20,8 @@
#include "map.h"
#include "annotate.h"
+#include "sane_ctype.h"
+
extern void hist_browser__init_hpp(void);
static int perf_evsel_browser_title(struct hist_browser *browser,
diff --git a/tools/perf/ui/browsers/map.c b/tools/perf/ui/browsers/map.c
index 9ce142de536d..ffa5addf631d 100644
--- a/tools/perf/ui/browsers/map.c
+++ b/tools/perf/ui/browsers/map.c
@@ -11,6 +11,8 @@
#include "../keysyms.h"
#include "map.h"
+#include "sane_ctype.h"
+
struct map_browser {
struct ui_browser b;
struct map *map;
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index d52d5f64ea89..297a79c69b71 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -4,7 +4,7 @@
#include "../../util/hist.h"
#include "../../util/sort.h"
#include "../../util/evsel.h"
-
+#include "../../util/sane_ctype.h"
static size_t callchain__fprintf_left_margin(FILE *fp, int left_margin)
{
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 4d4faf99d52d..d69fdafba274 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -26,6 +26,8 @@
#include <linux/kernel.h>
#include <sys/utsname.h>
+#include "sane_ctype.h"
+
const char *disassembler_style;
const char *objdump_path;
static regex_t file_lineno;
diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c
index a81a402a7459..0daf63b9ee3e 100644
--- a/tools/perf/util/auxtrace.c
+++ b/tools/perf/util/auxtrace.c
@@ -17,7 +17,6 @@
#include <sys/types.h>
#include <sys/mman.h>
#include <stdbool.h>
-#include <ctype.h>
#include <string.h>
#include <limits.h>
#include <errno.h>
@@ -47,7 +46,6 @@
#include "cpumap.h"
#include "thread_map.h"
#include "asm/bug.h"
-#include "symbol/kallsyms.h"
#include "auxtrace.h"
#include <linux/hash.h>
@@ -60,6 +58,9 @@
#include "intel-pt.h"
#include "intel-bts.h"
+#include "sane_ctype.h"
+#include "symbol/kallsyms.h"
+
int auxtrace_mmap__mmap(struct auxtrace_mmap *mm,
struct auxtrace_mmap_params *mp,
void *userpg, int fd)
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index 33af67530d30..3c0755563969 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -19,6 +19,7 @@
#include "vdso.h"
#include "probe-file.h"
+#include "sane_ctype.h"
static bool no_buildid_cache;
diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
index 7b01d59076d3..88783aa3dfc9 100644
--- a/tools/perf/util/config.c
+++ b/tools/perf/util/config.c
@@ -15,6 +15,8 @@
#include "util/llvm-utils.h" /* perf_llvm_config */
#include "config.h"
+#include "sane_ctype.h"
+
#define MAXNAME (256)
#define DEBUG_CACHE_DIR ".debug"
diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c
index 061018b42393..9d9ecb2430cc 100644
--- a/tools/perf/util/cpumap.c
+++ b/tools/perf/util/cpumap.c
@@ -8,6 +8,8 @@
#include <linux/bitmap.h>
#include "asm/bug.h"
+#include "sane_ctype.h"
+
static int max_cpu_num;
static int max_present_cpu_num;
static int max_node_num;
diff --git a/tools/perf/util/ctype.c b/tools/perf/util/ctype.c
index d4a5a21c2a7e..4b261c2ec0f1 100644
--- a/tools/perf/util/ctype.c
+++ b/tools/perf/util/ctype.c
@@ -3,7 +3,7 @@
*
* No surprises, and works with signed and unsigned chars.
*/
-#include "util.h"
+#include "sane_ctype.h"
enum {
S = GIT_SPACE,
diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c
index ef80221e0d9c..c3277b32e917 100644
--- a/tools/perf/util/data-convert-bt.c
+++ b/tools/perf/util/data-convert-bt.c
@@ -29,6 +29,7 @@
#include "evsel.h"
#include "machine.h"
#include "config.h"
+#include "sane_ctype.h"
#define pr_N(n, fmt, ...) \
eprintf(n, debug_data_convert, fmt, ##__VA_ARGS__)
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c
index 4d5df25f155a..41aa7c63e037 100644
--- a/tools/perf/util/debug.c
+++ b/tools/perf/util/debug.c
@@ -16,6 +16,8 @@
#include "util.h"
#include "target.h"
+#include "sane_ctype.h"
+
int verbose;
bool dump_trace = false, quiet = false;
int debug_ordered_events;
diff --git a/tools/perf/util/demangle-java.c b/tools/perf/util/demangle-java.c
index 3e6062ab2cdd..cb66d334f532 100644
--- a/tools/perf/util/demangle-java.c
+++ b/tools/perf/util/demangle-java.c
@@ -7,6 +7,8 @@
#include "demangle-java.h"
+#include "sane_ctype.h"
+
enum {
MODE_PREFIX = 0,
MODE_CLASS = 1,
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index b761b0eb60af..f8a706ba72f2 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -12,6 +12,7 @@
#include "strlist.h"
#include "thread.h"
#include "thread_map.h"
+#include "sane_ctype.h"
#include "symbol/kallsyms.h"
#include "asm/bug.h"
#include "stat.h"
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 99a13a63ff1f..757f73c4fa95 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -31,6 +31,8 @@
#include "stat.h"
#include "util/parse-branch-options.h"
+#include "sane_ctype.h"
+
static struct {
bool sample_id_all;
bool exclude_guest;
--git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 0371f3483ede..faf046fc398f 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -27,6 +27,8 @@
#include <api/fs/fs.h>
#include "asm/bug.h"
+#include "sane_ctype.h"
+
/*
* magic2 = "PERFILE2"
* must be a numerical value to let the endianness
diff --git a/tools/perf/util/jitdump.c b/tools/perf/util/jitdump.c
index da6262dbe9e3..d6d25327bc92 100644
--- a/tools/perf/util/jitdump.c
+++ b/tools/perf/util/jitdump.c
@@ -26,6 +26,8 @@
#include "genelf.h"
#include "../builtin.h"
+#include "sane_ctype.h"
+
struct jit_buf_desc {
struct perf_data_file *output;
struct perf_session *session;
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 15b2a17cf76e..f13f46a99b36 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -11,11 +11,13 @@
#include "thread.h"
#include "vdso.h"
#include <stdbool.h>
-#include <symbol/kallsyms.h>
#include "unwind.h"
#include "linux/hash.h"
#include "asm/bug.h"
+#include "sane_ctype.h"
+#include <symbol/kallsyms.h>
+
static void __machine__remove_thread(struct machine *machine, struct thread *th, bool lock);
static void dsos__init(struct dsos *dsos)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index e61b4b34a929..7caba7003734 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -48,6 +48,8 @@
#include "probe-file.h"
#include "session.h"
+#include "sane_ctype.h"
+
#define PERFPROBE_GROUP "probe"
bool probe_event_dry_run; /* Dry run flag */
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
index 2956c5198652..27f061551012 100644
--- a/tools/perf/util/probe-finder.h
+++ b/tools/perf/util/probe-finder.h
@@ -2,9 +2,9 @@
#define _PROBE_FINDER_H
#include <stdbool.h>
-#include "util.h"
#include "intlist.h"
#include "probe-event.h"
+#include "sane_ctype.h"
#define MAX_PROBE_BUFFER 1024
#define MAX_PROBES 128
diff --git a/tools/perf/util/sane_ctype.h b/tools/perf/util/sane_ctype.h
new file mode 100644
index 000000000000..4308c22c22ad
--- /dev/null
+++ b/tools/perf/util/sane_ctype.h
@@ -0,0 +1,51 @@
+#ifndef _PERF_SANE_CTYPE_H
+#define _PERF_SANE_CTYPE_H
+
+extern const char *graph_line;
+extern const char *graph_dotted_line;
+extern const char *spaces;
+extern const char *dots;
+
+/* Sane ctype - no locale, and works with signed chars */
+#undef isascii
+#undef isspace
+#undef isdigit
+#undef isxdigit
+#undef isalpha
+#undef isprint
+#undef isalnum
+#undef islower
+#undef isupper
+#undef tolower
+#undef toupper
+
+extern unsigned char sane_ctype[256];
+#define GIT_SPACE 0x01
+#define GIT_DIGIT 0x02
+#define GIT_ALPHA 0x04
+#define GIT_GLOB_SPECIAL 0x08
+#define GIT_REGEX_SPECIAL 0x10
+#define GIT_PRINT_EXTRA 0x20
+#define GIT_PRINT 0x3E
+#define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
+#define isascii(x) (((x) & ~0x7f) == 0)
+#define isspace(x) sane_istest(x,GIT_SPACE)
+#define isdigit(x) sane_istest(x,GIT_DIGIT)
+#define isxdigit(x) \
+ (sane_istest(toupper(x), GIT_ALPHA | GIT_DIGIT) && toupper(x) < 'G')
+#define isalpha(x) sane_istest(x,GIT_ALPHA)
+#define isalnum(x) sane_istest(x,GIT_ALPHA | GIT_DIGIT)
+#define isprint(x) sane_istest(x,GIT_PRINT)
+#define islower(x) (sane_istest(x,GIT_ALPHA) && (x & 0x20))
+#define isupper(x) (sane_istest(x,GIT_ALPHA) && !(x & 0x20))
+#define tolower(x) sane_case((unsigned char)(x), 0x20)
+#define toupper(x) sane_case((unsigned char)(x), 0)
+
+static inline int sane_case(int x, int high)
+{
+ if (sane_istest(x, GIT_ALPHA))
+ x = (x & ~0x20) | high;
+ return x;
+}
+
+#endif /* _PERF_SANE_CTYPE_H */
diff --git a/tools/perf/util/strfilter.c b/tools/perf/util/strfilter.c
index efb53772e0ec..c663c9153245 100644
--- a/tools/perf/util/strfilter.c
+++ b/tools/perf/util/strfilter.c
@@ -2,6 +2,8 @@
#include "string.h"
#include "strfilter.h"
+#include "sane_ctype.h"
+
/* Operators */
static const char *OP_and = "&"; /* Logical AND */
static const char *OP_or = "|"; /* Logical OR */
diff --git a/tools/perf/util/string.c b/tools/perf/util/string.c
index e8feb142c9c9..e716a6e5bb19 100644
--- a/tools/perf/util/string.c
+++ b/tools/perf/util/string.c
@@ -1,6 +1,8 @@
#include "util.h"
#include "linux/string.h"
+#include "sane_ctype.h"
+
#define K 1024LL
/*
* perf_atoll()
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index d1a40bb642ff..e7ee47f7377a 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -10,8 +10,9 @@
#include "demangle-rust.h"
#include "machine.h"
#include "vdso.h"
-#include <symbol/kallsyms.h>
#include "debug.h"
+#include "sane_ctype.h"
+#include <symbol/kallsyms.h>
#ifndef EM_AARCH64
#define EM_AARCH64 183 /* ARM 64 bit */
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 619e3eb44c50..68f14d770083 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -19,6 +19,7 @@
#include "strlist.h"
#include "intlist.h"
#include "header.h"
+#include "sane_ctype.h"
#include <elf.h>
#include <limits.h>
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index de0078e21408..746bbee645d9 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -21,13 +21,14 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <errno.h>
#include "../perf.h"
#include "util.h"
#include "trace-event.h"
+#include "sane_ctype.h"
+
static int get_common_field(struct scripting_context *context,
int *offset, int *size, const char *type)
{
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 524bd3b9d98d..717541e72999 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -21,6 +21,8 @@
#include "callchain.h"
#include "strlist.h"
+#include "sane_ctype.h"
+
#define CALLCHAIN_PARAM_DEFAULT \
.mode = CHAIN_GRAPH_ABS, \
.min_percent = 0.5, \
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index f26666d77677..f7e1ead50f47 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -43,10 +43,6 @@
#include <termios.h>
#include "strlist.h"
-extern const char *graph_line;
-extern const char *graph_dotted_line;
-extern const char *spaces;
-extern const char *dots;
extern char buildid_dir[];
#ifdef __GNUC__
@@ -94,48 +90,6 @@ static inline void *zalloc(size_t size)
#define zfree(ptr) ({ free(*ptr); *ptr = NULL; })
-/* Sane ctype - no locale, and works with signed chars */
-#undef isascii
-#undef isspace
-#undef isdigit
-#undef isxdigit
-#undef isalpha
-#undef isprint
-#undef isalnum
-#undef islower
-#undef isupper
-#undef tolower
-#undef toupper
-
-extern unsigned char sane_ctype[256];
-#define GIT_SPACE 0x01
-#define GIT_DIGIT 0x02
-#define GIT_ALPHA 0x04
-#define GIT_GLOB_SPECIAL 0x08
-#define GIT_REGEX_SPECIAL 0x10
-#define GIT_PRINT_EXTRA 0x20
-#define GIT_PRINT 0x3E
-#define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
-#define isascii(x) (((x) & ~0x7f) == 0)
-#define isspace(x) sane_istest(x,GIT_SPACE)
-#define isdigit(x) sane_istest(x,GIT_DIGIT)
-#define isxdigit(x) \
- (sane_istest(toupper(x), GIT_ALPHA | GIT_DIGIT) && toupper(x) < 'G')
-#define isalpha(x) sane_istest(x,GIT_ALPHA)
-#define isalnum(x) sane_istest(x,GIT_ALPHA | GIT_DIGIT)
-#define isprint(x) sane_istest(x,GIT_PRINT)
-#define islower(x) (sane_istest(x,GIT_ALPHA) && (x & 0x20))
-#define isupper(x) (sane_istest(x,GIT_ALPHA) && !(x & 0x20))
-#define tolower(x) sane_case((unsigned char)(x), 0x20)
-#define toupper(x) sane_case((unsigned char)(x), 0)
-
-static inline int sane_case(int x, int high)
-{
- if (sane_istest(x, GIT_ALPHA))
- x = (x & ~0x20) | high;
- return x;
-}
-
int mkdir_p(char *path, mode_t mode);
int rm_rf(const char *path);
struct strlist *lsdir(const char *name, bool (*filter)(const char *, struct dirent *));
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 15/28] tools include: Include missing headers for fls() and types in linux/log2.h
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
` (13 preceding siblings ...)
2017-04-19 16:17 ` [PATCH 14/28] perf tools: Move sane ctype stuff from util.h to sane_ctype.h Arnaldo Carvalho de Melo
@ 2017-04-19 16:17 ` Arnaldo Carvalho de Melo
2017-04-19 16:17 ` [PATCH 16/28] perf tools: Move print_binary definitions to separate files Arnaldo Carvalho de Melo
` (13 subsequent siblings)
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
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-7wj865zidu5ylf87i6i7v6z7@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/include/linux/log2.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/include/linux/log2.h b/tools/include/linux/log2.h
index d5677d39c1e4..0325cefc2220 100644
--- a/tools/include/linux/log2.h
+++ b/tools/include/linux/log2.h
@@ -12,6 +12,9 @@
#ifndef _TOOLS_LINUX_LOG2_H
#define _TOOLS_LINUX_LOG2_H
+#include <linux/bitops.h>
+#include <linux/types.h>
+
/*
* non-constant log of base 2 calculators
* - the arch may override these in asm/bitops.h if they can be implemented
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 16/28] perf tools: Move print_binary definitions to separate files
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
` (14 preceding siblings ...)
2017-04-19 16:17 ` [PATCH 15/28] tools include: Include missing headers for fls() and types in linux/log2.h Arnaldo Carvalho de Melo
@ 2017-04-19 16:17 ` Arnaldo Carvalho de Melo
2017-04-19 16:17 ` [PATCH 17/28] perf tools: Move srcline definitions to separate header Arnaldo Carvalho de Melo
` (12 subsequent siblings)
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Continuing the split of util.[ch] into more manageable bits.
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-5eu367rwcwnvvn7fz09l7xpb@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-script.c | 1 +
tools/perf/builtin-trace.c | 1 +
tools/perf/tests/is_printable_array.c | 2 +-
tools/perf/util/Build | 1 +
tools/perf/util/debug.c | 1 +
tools/perf/util/print_binary.c | 55 ++++++++++++++++++++++
tools/perf/util/print_binary.h | 28 +++++++++++
tools/perf/util/python-ext-sources | 1 +
tools/perf/util/python.c | 1 +
.../util/scripting-engines/trace-event-python.c | 1 +
tools/perf/util/util.c | 54 ---------------------
tools/perf/util/util.h | 23 ---------
12 files changed, 91 insertions(+), 78 deletions(-)
create mode 100644 tools/perf/util/print_binary.c
create mode 100644 tools/perf/util/print_binary.h
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 5afd9a62360a..5f4e36a4c444 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -23,6 +23,7 @@
#include "util/stat.h"
#include "util/thread-stack.h"
#include "util/time-utils.h"
+#include "print_binary.h"
#include <linux/bitmap.h>
#include <linux/kernel.h>
#include <linux/stringify.h>
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 0b00d8ac5226..9a8b9e6f47f7 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -36,6 +36,7 @@
#include "util/parse-events.h"
#include "util/bpf-loader.h"
#include "callchain.h"
+#include "print_binary.h"
#include "syscalltbl.h"
#include "rb_resort.h"
diff --git a/tools/perf/tests/is_printable_array.c b/tools/perf/tests/is_printable_array.c
index a008e5c2d980..a5192f6a20d7 100644
--- a/tools/perf/tests/is_printable_array.c
+++ b/tools/perf/tests/is_printable_array.c
@@ -2,7 +2,7 @@
#include <linux/kernel.h>
#include "tests.h"
#include "debug.h"
-#include "util.h"
+#include "print_binary.h"
int test__is_printable_array(int subtest __maybe_unused)
{
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 5c0ea11a8f0a..f0b9e5d0e2fc 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -16,6 +16,7 @@ libperf-y += llvm-utils.o
libperf-y += parse-events.o
libperf-y += perf_regs.o
libperf-y += path.o
+libperf-y += print_binary.o
libperf-y += rbtree.o
libperf-y += libstring.o
libperf-y += bitmap.o
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c
index 41aa7c63e037..6e1d7e159649 100644
--- a/tools/perf/util/debug.c
+++ b/tools/perf/util/debug.c
@@ -13,6 +13,7 @@
#include "color.h"
#include "event.h"
#include "debug.h"
+#include "print_binary.h"
#include "util.h"
#include "target.h"
diff --git a/tools/perf/util/print_binary.c b/tools/perf/util/print_binary.c
new file mode 100644
index 000000000000..e908177b9976
--- /dev/null
+++ b/tools/perf/util/print_binary.c
@@ -0,0 +1,55 @@
+#include "print_binary.h"
+#include <linux/log2.h>
+#include "sane_ctype.h"
+
+void print_binary(unsigned char *data, size_t len,
+ size_t bytes_per_line, print_binary_t printer,
+ void *extra)
+{
+ size_t i, j, mask;
+
+ if (!printer)
+ return;
+
+ bytes_per_line = roundup_pow_of_two(bytes_per_line);
+ mask = bytes_per_line - 1;
+
+ printer(BINARY_PRINT_DATA_BEGIN, 0, extra);
+ for (i = 0; i < len; i++) {
+ if ((i & mask) == 0) {
+ printer(BINARY_PRINT_LINE_BEGIN, -1, extra);
+ printer(BINARY_PRINT_ADDR, i, extra);
+ }
+
+ printer(BINARY_PRINT_NUM_DATA, data[i], extra);
+
+ if (((i & mask) == mask) || i == len - 1) {
+ for (j = 0; j < mask-(i & mask); j++)
+ printer(BINARY_PRINT_NUM_PAD, -1, extra);
+
+ printer(BINARY_PRINT_SEP, i, extra);
+ for (j = i & ~mask; j <= i; j++)
+ printer(BINARY_PRINT_CHAR_DATA, data[j], extra);
+ for (j = 0; j < mask-(i & mask); j++)
+ printer(BINARY_PRINT_CHAR_PAD, i, extra);
+ printer(BINARY_PRINT_LINE_END, -1, extra);
+ }
+ }
+ printer(BINARY_PRINT_DATA_END, -1, extra);
+}
+
+int is_printable_array(char *p, unsigned int len)
+{
+ unsigned int i;
+
+ if (!p || !len || p[len - 1] != 0)
+ return 0;
+
+ len--;
+
+ for (i = 0; i < len; i++) {
+ if (!isprint(p[i]) && !isspace(p[i]))
+ return 0;
+ }
+ return 1;
+}
diff --git a/tools/perf/util/print_binary.h b/tools/perf/util/print_binary.h
new file mode 100644
index 000000000000..da0427263d2d
--- /dev/null
+++ b/tools/perf/util/print_binary.h
@@ -0,0 +1,28 @@
+#ifndef PERF_PRINT_BINARY_H
+#define PERF_PRINT_BINARY_H
+
+#include <stddef.h>
+
+enum binary_printer_ops {
+ BINARY_PRINT_DATA_BEGIN,
+ BINARY_PRINT_LINE_BEGIN,
+ BINARY_PRINT_ADDR,
+ BINARY_PRINT_NUM_DATA,
+ BINARY_PRINT_NUM_PAD,
+ BINARY_PRINT_SEP,
+ BINARY_PRINT_CHAR_DATA,
+ BINARY_PRINT_CHAR_PAD,
+ BINARY_PRINT_LINE_END,
+ BINARY_PRINT_DATA_END,
+};
+
+typedef void (*print_binary_t)(enum binary_printer_ops op,
+ unsigned int val, void *extra);
+
+void print_binary(unsigned char *data, size_t len,
+ size_t bytes_per_line, print_binary_t printer,
+ void *extra);
+
+int is_printable_array(char *p, unsigned int len);
+
+#endif /* PERF_PRINT_BINARY_H */
diff --git a/tools/perf/util/python-ext-sources b/tools/perf/util/python-ext-sources
index 0546a4304347..7d3927447fba 100644
--- a/tools/perf/util/python-ext-sources
+++ b/tools/perf/util/python-ext-sources
@@ -21,6 +21,7 @@ util/cgroup.c
util/parse-branch-options.c
util/rblist.c
util/counts.c
+util/print_binary.c
util/strlist.c
util/trace-event.c
../lib/rbtree.c
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
index a5fbc012e3df..0533711af44d 100644
--- a/tools/perf/util/python.c
+++ b/tools/perf/util/python.c
@@ -7,6 +7,7 @@
#include "evsel.h"
#include "event.h"
#include "cpumap.h"
+#include "print_binary.h"
#include "thread_map.h"
/*
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index dd61213e7a3c..9d92af7d0718 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -46,6 +46,7 @@
#include "../call-path.h"
#include "thread_map.h"
#include "cpumap.h"
+#include "print_binary.h"
#include "stat.h"
PyMODINIT_FUNC initperf_trace_context(void);
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 717541e72999..4fb8ee552a31 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -21,8 +21,6 @@
#include "callchain.h"
#include "strlist.h"
-#include "sane_ctype.h"
-
#define CALLCHAIN_PARAM_DEFAULT \
.mode = CHAIN_GRAPH_ABS, \
.min_percent = 0.5, \
@@ -742,58 +740,6 @@ int fetch_current_timestamp(char *buf, size_t sz)
return 0;
}
-void print_binary(unsigned char *data, size_t len,
- size_t bytes_per_line, print_binary_t printer,
- void *extra)
-{
- size_t i, j, mask;
-
- if (!printer)
- return;
-
- bytes_per_line = roundup_pow_of_two(bytes_per_line);
- mask = bytes_per_line - 1;
-
- printer(BINARY_PRINT_DATA_BEGIN, 0, extra);
- for (i = 0; i < len; i++) {
- if ((i & mask) == 0) {
- printer(BINARY_PRINT_LINE_BEGIN, -1, extra);
- printer(BINARY_PRINT_ADDR, i, extra);
- }
-
- printer(BINARY_PRINT_NUM_DATA, data[i], extra);
-
- if (((i & mask) == mask) || i == len - 1) {
- for (j = 0; j < mask-(i & mask); j++)
- printer(BINARY_PRINT_NUM_PAD, -1, extra);
-
- printer(BINARY_PRINT_SEP, i, extra);
- for (j = i & ~mask; j <= i; j++)
- printer(BINARY_PRINT_CHAR_DATA, data[j], extra);
- for (j = 0; j < mask-(i & mask); j++)
- printer(BINARY_PRINT_CHAR_PAD, i, extra);
- printer(BINARY_PRINT_LINE_END, -1, extra);
- }
- }
- printer(BINARY_PRINT_DATA_END, -1, extra);
-}
-
-int is_printable_array(char *p, unsigned int len)
-{
- unsigned int i;
-
- if (!p || !len || p[len - 1] != 0)
- return 0;
-
- len--;
-
- for (i = 0; i < len; i++) {
- if (!isprint(p[i]) && !isspace(p[i]))
- return 0;
- }
- return 1;
-}
-
int unit_number__scnprintf(char *buf, size_t size, u64 n)
{
char unit[4] = "BKMG";
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index f7e1ead50f47..4d9069ab569a 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -213,33 +213,10 @@ const char *perf_tip(const char *dirpath);
bool is_regular_file(const char *file);
int fetch_current_timestamp(char *buf, size_t sz);
-enum binary_printer_ops {
- BINARY_PRINT_DATA_BEGIN,
- BINARY_PRINT_LINE_BEGIN,
- BINARY_PRINT_ADDR,
- BINARY_PRINT_NUM_DATA,
- BINARY_PRINT_NUM_PAD,
- BINARY_PRINT_SEP,
- BINARY_PRINT_CHAR_DATA,
- BINARY_PRINT_CHAR_PAD,
- BINARY_PRINT_LINE_END,
- BINARY_PRINT_DATA_END,
-};
-
-typedef void (*print_binary_t)(enum binary_printer_ops,
- unsigned int val,
- void *extra);
-
-void print_binary(unsigned char *data, size_t len,
- size_t bytes_per_line, print_binary_t printer,
- void *extra);
-
#ifndef HAVE_SCHED_GETCPU_SUPPORT
int sched_getcpu(void);
#endif
-int is_printable_array(char *p, unsigned int len);
-
int timestamp__scnprintf_usec(u64 timestamp, char *buf, size_t sz);
int unit_number__scnprintf(char *buf, size_t size, u64 n);
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 17/28] perf tools: Move srcline definitions to separate header
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
` (15 preceding siblings ...)
2017-04-19 16:17 ` [PATCH 16/28] perf tools: Move print_binary definitions to separate files Arnaldo Carvalho de Melo
@ 2017-04-19 16:17 ` Arnaldo Carvalho de Melo
2017-04-19 16:17 ` [PATCH 18/28] perf tools: Move extra string util functions to util/string2.h Arnaldo Carvalho de Melo
` (11 subsequent siblings)
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Out of util.h into a new file, srcline.h
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-ludnlm4djqcdjziekzr4s3u9@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/ui/browsers/hists.c | 1 +
tools/perf/ui/stdio/hist.c | 1 +
tools/perf/util/hist.c | 1 +
tools/perf/util/map.c | 1 +
tools/perf/util/sort.h | 1 +
tools/perf/util/srcline.c | 1 +
tools/perf/util/srcline.h | 34 ++++++++++++++++++++++++++++++++++
tools/perf/util/util.h | 27 ---------------------------
8 files changed, 40 insertions(+), 27 deletions(-)
create mode 100644 tools/perf/util/srcline.h
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 56f5c038689e..ac7f6a3e4a86 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -19,6 +19,7 @@
#include "../ui.h"
#include "map.h"
#include "annotate.h"
+#include "srcline.h"
#include "sane_ctype.h"
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 297a79c69b71..66aa4eb369f1 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -4,6 +4,7 @@
#include "../../util/hist.h"
#include "../../util/sort.h"
#include "../../util/evsel.h"
+#include "../../util/srcline.h"
#include "../../util/sane_ctype.h"
static size_t callchain__fprintf_left_margin(FILE *fp, int left_margin)
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 61bf304206fd..af3bd5d31d99 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -8,6 +8,7 @@
#include "evlist.h"
#include "evsel.h"
#include "annotate.h"
+#include "srcline.h"
#include "ui/progress.h"
#include <math.h>
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index c1870ac365a3..9059d20c3b8a 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -16,6 +16,7 @@
#include "debug.h"
#include "machine.h"
#include <linux/string.h>
+#include "srcline.h"
#include "unwind.h"
static void __maps__insert(struct maps *maps, struct map *map);
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index e35fb186d048..535903297cee 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -21,6 +21,7 @@
#include <subcmd/parse-options.h>
#include "parse-events.h"
#include "hist.h"
+#include "srcline.h"
#include "thread.h"
extern regex_t parent_regex;
diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c
index ef192802edc9..df051a52393c 100644
--- a/tools/perf/util/srcline.c
+++ b/tools/perf/util/srcline.c
@@ -9,6 +9,7 @@
#include "util/util.h"
#include "util/debug.h"
#include "util/callchain.h"
+#include "srcline.h"
#include "symbol.h"
diff --git a/tools/perf/util/srcline.h b/tools/perf/util/srcline.h
new file mode 100644
index 000000000000..7b52ba88676e
--- /dev/null
+++ b/tools/perf/util/srcline.h
@@ -0,0 +1,34 @@
+#ifndef PERF_SRCLINE_H
+#define PERF_SRCLINE_H
+
+#include <linux/list.h>
+#include <linux/types.h>
+
+struct dso;
+struct symbol;
+
+extern bool srcline_full_filename;
+char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym,
+ bool show_sym, bool show_addr);
+char *__get_srcline(struct dso *dso, u64 addr, struct symbol *sym,
+ bool show_sym, bool show_addr, bool unwind_inlines);
+void free_srcline(char *srcline);
+
+#define SRCLINE_UNKNOWN ((char *) "??:0")
+
+struct inline_list {
+ char *filename;
+ char *funcname;
+ unsigned int line_nr;
+ struct list_head list;
+};
+
+struct inline_node {
+ u64 addr;
+ struct list_head val;
+};
+
+struct inline_node *dso__parse_addr_inlines(struct dso *dso, u64 addr);
+void inline_node__delete(struct inline_node *node);
+
+#endif /* PERF_SRCLINE_H */
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 4d9069ab569a..46cfdccc32bc 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -144,8 +144,6 @@ struct parse_tag {
unsigned long parse_tag_value(const char *str, struct parse_tag *tags);
-#define SRCLINE_UNKNOWN ((char *) "??:0")
-
static inline int path__join(char *bf, size_t size,
const char *path1, const char *path2)
{
@@ -161,16 +159,6 @@ static inline int path__join3(char *bf, size_t size,
path2, path2[0] ? "/" : "", path3);
}
-struct dso;
-struct symbol;
-
-extern bool srcline_full_filename;
-char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym,
- bool show_sym, bool show_addr);
-char *__get_srcline(struct dso *dso, u64 addr, struct symbol *sym,
- bool show_sym, bool show_addr, bool unwind_inlines);
-void free_srcline(char *srcline);
-
int perf_event_paranoid(void);
void mem_bswap_64(void *src, int byte_size);
@@ -221,19 +209,4 @@ int timestamp__scnprintf_usec(u64 timestamp, char *buf, size_t sz);
int unit_number__scnprintf(char *buf, size_t size, u64 n);
-struct inline_list {
- char *filename;
- char *funcname;
- unsigned int line_nr;
- struct list_head list;
-};
-
-struct inline_node {
- u64 addr;
- struct list_head val;
-};
-
-struct inline_node *dso__parse_addr_inlines(struct dso *dso, u64 addr);
-void inline_node__delete(struct inline_node *node);
-
#endif /* GIT_COMPAT_UTIL_H */
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 18/28] perf tools: Move extra string util functions to util/string2.h
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
` (16 preceding siblings ...)
2017-04-19 16:17 ` [PATCH 17/28] perf tools: Move srcline definitions to separate header Arnaldo Carvalho de Melo
@ 2017-04-19 16:17 ` Arnaldo Carvalho de Melo
2017-04-19 16:17 ` [PATCH 19/28] perf tools: Include errno.h where needed Arnaldo Carvalho de Melo
` (10 subsequent siblings)
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Moving them from util.h, where they don't belong. Since libc already
have string.h, name it slightly differently, as string2.h.
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-eh3vz5sqxsrdd8lodoro4jrw@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/bench/mem-functions.c | 1 +
tools/perf/builtin-script.c | 1 +
tools/perf/builtin-stat.c | 1 +
tools/perf/builtin-trace.c | 1 +
tools/perf/ui/browser.c | 1 +
tools/perf/ui/browsers/hists.c | 1 +
tools/perf/ui/gtk/hists.c | 1 +
tools/perf/ui/stdio/hist.c | 1 +
tools/perf/util/annotate.c | 1 +
tools/perf/util/dso.c | 1 +
tools/perf/util/dwarf-aux.c | 1 +
tools/perf/util/event.c | 2 +-
| 1 +
tools/perf/util/parse-events.c | 2 +-
tools/perf/util/pmu.c | 1 +
tools/perf/util/probe-event.c | 1 +
tools/perf/util/probe-file.c | 1 +
tools/perf/util/probe-finder.c | 1 +
tools/perf/util/strfilter.c | 2 +-
tools/perf/util/string.c | 16 +++++++++------
tools/perf/util/string2.h | 42 ++++++++++++++++++++++++++++++++++++++++
tools/perf/util/thread_map.c | 1 +
tools/perf/util/util.h | 32 ------------------------------
23 files changed, 72 insertions(+), 41 deletions(-)
create mode 100644 tools/perf/util/string2.h
diff --git a/tools/perf/bench/mem-functions.c b/tools/perf/bench/mem-functions.c
index d1dea33dcfcf..fbd732b54047 100644
--- a/tools/perf/bench/mem-functions.c
+++ b/tools/perf/bench/mem-functions.c
@@ -12,6 +12,7 @@
#include <subcmd/parse-options.h>
#include "../util/header.h"
#include "../util/cloexec.h"
+#include "../util/string2.h"
#include "bench.h"
#include "mem-memcpy-arch.h"
#include "mem-memset-arch.h"
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 5f4e36a4c444..a710f6867954 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -21,6 +21,7 @@
#include "util/cpumap.h"
#include "util/thread_map.h"
#include "util/stat.h"
+#include "util/string2.h"
#include "util/thread-stack.h"
#include "util/time-utils.h"
#include "print_binary.h"
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 5abef25f9983..1da86e6708c0 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -64,6 +64,7 @@
#include "util/session.h"
#include "util/tool.h"
#include "util/group.h"
+#include "util/string2.h"
#include "asm/bug.h"
#include <linux/time64.h>
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 9a8b9e6f47f7..4160d946a34d 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -37,6 +37,7 @@
#include "util/bpf-loader.h"
#include "callchain.h"
#include "print_binary.h"
+#include "string2.h"
#include "syscalltbl.h"
#include "rb_resort.h"
diff --git a/tools/perf/ui/browser.c b/tools/perf/ui/browser.c
index 73bdd07321c4..a4d3762cd825 100644
--- a/tools/perf/ui/browser.c
+++ b/tools/perf/ui/browser.c
@@ -1,4 +1,5 @@
#include "../util.h"
+#include "../string2.h"
#include "../config.h"
#include "../../perf.h"
#include "libslang.h"
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index ac7f6a3e4a86..bc397bbbc3a7 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -20,6 +20,7 @@
#include "map.h"
#include "annotate.h"
#include "srcline.h"
+#include "string2.h"
#include "sane_ctype.h"
diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c
index a4f02de7c1b5..c42de4dcc055 100644
--- a/tools/perf/ui/gtk/hists.c
+++ b/tools/perf/ui/gtk/hists.c
@@ -4,6 +4,7 @@
#include "../sort.h"
#include "../hist.h"
#include "../helpline.h"
+#include "../string2.h"
#include "gtk.h"
#define MAX_COLUMNS 32
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 66aa4eb369f1..5565105c9688 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -5,6 +5,7 @@
#include "../../util/sort.h"
#include "../../util/evsel.h"
#include "../../util/srcline.h"
+#include "../../util/string2.h"
#include "../../util/sane_ctype.h"
static size_t callchain__fprintf_left_margin(FILE *fp, int left_margin)
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index d69fdafba274..297bf5c66609 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -19,6 +19,7 @@
#include "annotate.h"
#include "evsel.h"
#include "block-range.h"
+#include "string2.h"
#include "arch/common.h"
#include <regex.h>
#include <pthread.h>
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 385c82e12473..6ad57730a0ed 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -8,6 +8,7 @@
#include "auxtrace.h"
#include "util.h"
#include "debug.h"
+#include "string2.h"
#include "vdso.h"
static const char * const debuglink_paths[] = {
diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c
index 5fb186d142f6..780ee4629bd0 100644
--- a/tools/perf/util/dwarf-aux.c
+++ b/tools/perf/util/dwarf-aux.c
@@ -22,6 +22,7 @@
#include "util.h"
#include "debug.h"
#include "dwarf-aux.h"
+#include "string2.h"
/**
* cu_find_realpath - Find the realpath of the target file
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index f8a706ba72f2..53b81b2283c1 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -8,7 +8,7 @@
#include "hist.h"
#include "machine.h"
#include "sort.h"
-#include "string.h"
+#include "string2.h"
#include "strlist.h"
#include "thread.h"
#include "thread_map.h"
--git a/tools/perf/util/header.c b/tools/perf/util/header.c
index faf046fc398f..51865b8cb9f3 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -1,5 +1,6 @@
#include <inttypes.h>
#include "util.h"
+#include "string2.h"
#include <sys/types.h>
#include <byteswap.h>
#include <unistd.h>
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 6b498aea9fde..535c7cbb2bfb 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -7,7 +7,7 @@
#include <subcmd/parse-options.h>
#include "parse-events.h"
#include <subcmd/exec-cmd.h>
-#include "string.h"
+#include "string2.h"
#include "symbol.h"
#include "cache.h"
#include "header.h"
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 11c752561c55..7503fa170249 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -15,6 +15,7 @@
#include "header.h"
#include "pmu-events/pmu-events.h"
#include "cache.h"
+#include "string2.h"
struct perf_pmu_format {
char *name;
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 7caba7003734..8f1374071cfc 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -47,6 +47,7 @@
#include "probe-finder.h"
#include "probe-file.h"
#include "session.h"
+#include "string2.h"
#include "sane_ctype.h"
diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
index 88714dec8912..7942ea5c7e81 100644
--- a/tools/perf/util/probe-file.c
+++ b/tools/perf/util/probe-file.c
@@ -28,6 +28,7 @@
#include "probe-file.h"
#include "session.h"
#include "perf_regs.h"
+#include "string2.h"
/* 4096 - 2 ('\n' + '\0') */
#define MAX_CMDLEN 4094
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 9ddd7dad2e6e..3f3cd11d3b7c 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -41,6 +41,7 @@
#include "symbol.h"
#include "probe-finder.h"
#include "probe-file.h"
+#include "string2.h"
/* Kprobe tracer basic type is up to u64 */
#define MAX_BASIC_TYPE_BITS 64
diff --git a/tools/perf/util/strfilter.c b/tools/perf/util/strfilter.c
index c663c9153245..3b068e0e2d59 100644
--- a/tools/perf/util/strfilter.c
+++ b/tools/perf/util/strfilter.c
@@ -1,5 +1,5 @@
#include "util.h"
-#include "string.h"
+#include "string2.h"
#include "strfilter.h"
#include "sane_ctype.h"
diff --git a/tools/perf/util/string.c b/tools/perf/util/string.c
index e716a6e5bb19..cca53b693a48 100644
--- a/tools/perf/util/string.c
+++ b/tools/perf/util/string.c
@@ -1,5 +1,7 @@
-#include "util.h"
-#include "linux/string.h"
+#include "string2.h"
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <stdlib.h>
#include "sane_ctype.h"
@@ -101,8 +103,10 @@ static int count_argc(const char *str)
void argv_free(char **argv)
{
char **p;
- for (p = argv; *p; p++)
- zfree(p);
+ for (p = argv; *p; p++) {
+ free(*p);
+ *p = NULL;
+ }
free(argv);
}
@@ -122,7 +126,7 @@ void argv_free(char **argv)
char **argv_split(const char *str, int *argcp)
{
int argc = count_argc(str);
- char **argv = zalloc(sizeof(*argv) * (argc+1));
+ char **argv = calloc(argc + 1, sizeof(*argv));
char **argvp;
if (argv == NULL)
@@ -379,7 +383,7 @@ char *asprintf_expr_inout_ints(const char *var, bool in, size_t nints, int *ints
goto out_err_overflow;
if (i > 0)
- printed += snprintf(e + printed, size - printed, " %s ", or_and);
+ printed += scnprintf(e + printed, size - printed, " %s ", or_and);
printed += scnprintf(e + printed, size - printed,
"%s %s %d", var, eq_neq, ints[i]);
}
diff --git a/tools/perf/util/string2.h b/tools/perf/util/string2.h
new file mode 100644
index 000000000000..2f619681bd6a
--- /dev/null
+++ b/tools/perf/util/string2.h
@@ -0,0 +1,42 @@
+#ifndef PERF_STRING_H
+#define PERF_STRING_H
+
+#include <linux/types.h>
+#include <stddef.h>
+#include <string.h>
+
+s64 perf_atoll(const char *str);
+char **argv_split(const char *str, int *argcp);
+void argv_free(char **argv);
+bool strglobmatch(const char *str, const char *pat);
+bool strglobmatch_nocase(const char *str, const char *pat);
+bool strlazymatch(const char *str, const char *pat);
+static inline bool strisglob(const char *str)
+{
+ return strpbrk(str, "*?[") != NULL;
+}
+int strtailcmp(const char *s1, const char *s2);
+char *strxfrchar(char *s, char from, char to);
+
+char *ltrim(char *s);
+char *rtrim(char *s);
+
+static inline char *trim(char *s)
+{
+ return ltrim(rtrim(s));
+}
+
+char *asprintf_expr_inout_ints(const char *var, bool in, size_t nints, int *ints);
+
+static inline char *asprintf_expr_in_ints(const char *var, size_t nints, int *ints)
+{
+ return asprintf_expr_inout_ints(var, true, nints, ints);
+}
+
+static inline char *asprintf_expr_not_in_ints(const char *var, size_t nints, int *ints)
+{
+ return asprintf_expr_inout_ints(var, false, nints, ints);
+}
+
+
+#endif /* PERF_STRING_H */
diff --git a/tools/perf/util/thread_map.c b/tools/perf/util/thread_map.c
index 9026408ea55b..ef86bf517e01 100644
--- a/tools/perf/util/thread_map.c
+++ b/tools/perf/util/thread_map.c
@@ -6,6 +6,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
+#include "string2.h"
#include "strlist.h"
#include <string.h>
#include <api/fs/fs.h>
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 46cfdccc32bc..850ca54d17a5 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -98,18 +98,6 @@ int copyfile(const char *from, const char *to);
int copyfile_mode(const char *from, const char *to, mode_t mode);
int copyfile_offset(int fromfd, loff_t from_ofs, int tofd, loff_t to_ofs, u64 size);
-s64 perf_atoll(const char *str);
-char **argv_split(const char *str, int *argcp);
-void argv_free(char **argv);
-bool strglobmatch(const char *str, const char *pat);
-bool strglobmatch_nocase(const char *str, const char *pat);
-bool strlazymatch(const char *str, const char *pat);
-static inline bool strisglob(const char *str)
-{
- return strpbrk(str, "*?[") != NULL;
-}
-int strtailcmp(const char *s1, const char *s2);
-char *strxfrchar(char *s, char from, char to);
unsigned long convert_unit(unsigned long value, char *unit);
ssize_t readn(int fd, void *buf, size_t n);
ssize_t writen(int fd, void *buf, size_t n);
@@ -121,14 +109,6 @@ void event_attr_init(struct perf_event_attr *attr);
size_t hex_width(u64 v);
int hex2u64(const char *ptr, u64 *val);
-char *ltrim(char *s);
-char *rtrim(char *s);
-
-static inline char *trim(char *s)
-{
- return ltrim(rtrim(s));
-}
-
void dump_stack(void);
void sighandler_dump_stack(int sig);
@@ -175,18 +155,6 @@ int gzip_decompress_to_file(const char *input, int output_fd);
int lzma_decompress_to_file(const char *input, int output_fd);
#endif
-char *asprintf_expr_inout_ints(const char *var, bool in, size_t nints, int *ints);
-
-static inline char *asprintf_expr_in_ints(const char *var, size_t nints, int *ints)
-{
- return asprintf_expr_inout_ints(var, true, nints, ints);
-}
-
-static inline char *asprintf_expr_not_in_ints(const char *var, size_t nints, int *ints)
-{
- return asprintf_expr_inout_ints(var, false, nints, ints);
-}
-
int get_stack_size(const char *str, unsigned long *_size);
int fetch_kernel_version(unsigned int *puint,
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 19/28] perf tools: Include errno.h where needed
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
` (17 preceding siblings ...)
2017-04-19 16:17 ` [PATCH 18/28] perf tools: Move extra string util functions to util/string2.h Arnaldo Carvalho de Melo
@ 2017-04-19 16:17 ` Arnaldo Carvalho de Melo
2017-04-19 16:17 ` [PATCH 20/28] perf str{filter,list}: Disentangle headers Arnaldo Carvalho de Melo
` (9 subsequent siblings)
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
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>
---
tools/perf/arch/arm64/util/dwarf-regs.c | 1 +
tools/perf/arch/powerpc/util/kvm-stat.c | 1 +
tools/perf/arch/powerpc/util/perf_regs.c | 1 +
tools/perf/arch/s390/util/kvm-stat.c | 1 +
tools/perf/arch/x86/tests/intel-cqm.c | 1 +
tools/perf/arch/x86/tests/perf-time-to-tsc.c | 1 +
tools/perf/arch/x86/util/auxtrace.c | 1 +
tools/perf/arch/x86/util/intel-bts.c | 1 +
tools/perf/arch/x86/util/intel-pt.c | 1 +
tools/perf/arch/x86/util/kvm-stat.c | 1 +
tools/perf/arch/x86/util/perf_regs.c | 1 +
tools/perf/builtin-annotate.c | 1 +
tools/perf/builtin-buildid-cache.c | 1 +
tools/perf/builtin-buildid-list.c | 1 +
tools/perf/builtin-c2c.c | 1 +
tools/perf/builtin-diff.c | 1 +
tools/perf/builtin-ftrace.c | 1 +
tools/perf/builtin-help.c | 1 +
tools/perf/builtin-inject.c | 1 +
tools/perf/builtin-kmem.c | 1 +
tools/perf/builtin-kvm.c | 1 +
tools/perf/builtin-lock.c | 1 +
tools/perf/builtin-record.c | 1 +
tools/perf/builtin-report.c | 1 +
tools/perf/builtin-sched.c | 1 +
tools/perf/builtin-script.c | 1 +
tools/perf/builtin-stat.c | 1 +
tools/perf/builtin-timechart.c | 1 +
tools/perf/builtin-trace.c | 1 +
tools/perf/perf.c | 1 +
tools/perf/tests/attr.c | 1 +
tools/perf/tests/backward-ring-buffer.c | 1 +
tools/perf/tests/bpf.c | 1 +
tools/perf/tests/builtin-test.c | 1 +
tools/perf/tests/code-reading.c | 1 +
tools/perf/tests/event-times.c | 1 +
tools/perf/tests/evsel-roundtrip-name.c | 1 +
tools/perf/tests/hists_link.c | 1 +
tools/perf/tests/mmap-basic.c | 1 +
tools/perf/tests/openat-syscall-all-cpus.c | 1 +
tools/perf/tests/openat-syscall-tp-fields.c | 1 +
tools/perf/tests/openat-syscall.c | 1 +
tools/perf/tests/parse-events.c | 1 +
tools/perf/tests/perf-record.c | 1 +
tools/perf/tests/pmu.c | 1 +
tools/perf/tests/sdt.c | 1 +
tools/perf/tests/sw-clock.c | 1 +
tools/perf/tests/switch-tracking.c | 1 +
tools/perf/tests/task-exit.c | 1 +
tools/perf/ui/browsers/hists.c | 1 +
tools/perf/util/annotate.c | 1 +
tools/perf/util/auxtrace.h | 1 +
tools/perf/util/bpf-loader.c | 1 +
tools/perf/util/bpf-loader.h | 2 ++
tools/perf/util/bpf-prologue.c | 1 +
tools/perf/util/bpf-prologue.h | 2 ++
tools/perf/util/build-id.c | 1 +
tools/perf/util/c++/clang-c.h | 1 +
tools/perf/util/cloexec.c | 1 +
tools/perf/util/comm.c | 1 +
tools/perf/util/config.c | 1 +
tools/perf/util/counts.c | 1 +
tools/perf/util/data-convert-bt.c | 1 +
tools/perf/util/data.c | 1 +
tools/perf/util/drv_configs.c | 1 +
tools/perf/util/dso.c | 1 +
tools/perf/util/dwarf-aux.c | 1 +
tools/perf/util/env.c | 1 +
tools/perf/util/event.c | 1 +
tools/perf/util/evlist.c | 1 +
tools/perf/util/evsel.c | 1 +
| 1 +
tools/perf/util/hist.c | 1 +
tools/perf/util/intel-bts.c | 1 +
tools/perf/util/jitdump.c | 1 +
tools/perf/util/lzma.c | 1 +
tools/perf/util/machine.c | 1 +
tools/perf/util/ordered-events.c | 1 +
tools/perf/util/parse-events.c | 1 +
tools/perf/util/pmu.c | 1 +
tools/perf/util/probe-file.c | 1 +
tools/perf/util/quote.c | 1 +
tools/perf/util/record.c | 1 +
tools/perf/util/session.c | 1 +
tools/perf/util/sort.c | 1 +
tools/perf/util/stat.c | 1 +
tools/perf/util/strbuf.c | 1 +
tools/perf/util/strfilter.c | 1 +
tools/perf/util/symbol-minimal.c | 1 +
tools/perf/util/thread-stack.c | 1 +
tools/perf/util/thread.c | 1 +
tools/perf/util/thread_map.c | 1 +
tools/perf/util/unwind-libunwind-local.c | 1 +
tools/perf/util/util.h | 1 -
tools/perf/util/vdso.c | 2 +-
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 @@
* published by the Free Software Foundation.
*/
+#include <errno.h>
#include <stddef.h>
#include <dwarf-regs.h>
#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 @@
+#include <errno.h>
#include "util/kvm-stat.h"
#include "util/parse-events.h"
#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 @@
+#include <errno.h>
#include <string.h>
#include <regex.h>
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 @@
* as published by the Free Software Foundation.
*/
+#include <errno.h>
#include "../../util/kvm-stat.h"
#include <asm/sie.h>
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 @@
#include "arch-tests.h"
#include <sys/mman.h>
+#include <errno.h>
#include <string.h>
static 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 @@
+#include <errno.h>
#include <inttypes.h>
#include <stdio.h>
#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 @@
*
*/
+#include <errno.h>
#include <stdbool.h>
#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 @@
*
*/
+#include <errno.h>
#include <linux/kernel.h>
#include <linux/types.h>
#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 @@
*
*/
+#include <errno.h>
#include <stdbool.h>
#include <linux/kernel.h>
#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 @@
+#include <errno.h>
#include "../../util/kvm-stat.h"
#include <asm/svm.h>
#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 @@
+#include <errno.h>
#include <string.h>
#include <regex.h>
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 @@
#include "util/block-range.h"
#include <dlfcn.h>
+#include <errno.h>
#include <linux/bitmap.h>
struct 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 @@
#include <sys/time.h>
#include <time.h>
#include <dirent.h>
+#include <errno.h>
#include <unistd.h>
#include "builtin.h"
#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 @@
#include "util/session.h"
#include "util/symbol.h"
#include "util/data.h"
+#include <errno.h>
static int sysfs__fprintf_build_id(FILE *fp)
{
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 @@
* Dick Fowles <fowles@inreach.com>
* Joe Mario <jmario@redhat.com>
*/
+#include <errno.h>
#include <inttypes.h>
#include <linux/compiler.h>
#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 @@
#include "util/data.h"
#include "util/config.h"
+#include <errno.h>
#include <inttypes.h>
#include <stdlib.h>
#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 @@
#include "builtin.h"
#include "perf.h"
+#include <errno.h>
#include <unistd.h>
#include <signal.h>
#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 @@
#include <subcmd/help.h>
#include "util/debug.h"
#include <linux/kernel.h>
+#include <errno.h>
static struct man_viewer_list {
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 @@
#include <subcmd/parse-options.h>
#include <linux/list.h>
+#include <errno.h>
struct perf_inject {
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 @@
#include <linux/kernel.h>
#include <linux/rbtree.h>
#include <linux/string.h>
+#include <errno.h>
#include <inttypes.h>
#include <locale.h>
#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 @@
#include <linux/kernel.h>
#include <linux/time64.h>
+#include <errno.h>
#include <inttypes.h>
#include <termios.h>
#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 @@
+#include <errno.h>
#include <inttypes.h>
#include "builtin.h"
#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 @@
#include "util/perf-hooks.h"
#include "asm/bug.h"
+#include <errno.h>
#include <inttypes.h>
#include <unistd.h>
#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 @@
#include "util/auxtrace.h"
#include <dlfcn.h>
+#include <errno.h>
#include <inttypes.h>
#include <linux/bitmap.h>
#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 @@
#include <sys/resource.h>
#include <inttypes.h>
+#include <errno.h>
#include <semaphore.h>
#include <pthread.h>
#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 @@
#include "asm/bug.h"
#include "util/mem-events.h"
#include "util/dump-insn.h"
+#include <errno.h>
#include <inttypes.h>
#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 @@
#include <linux/time64.h>
#include <api/fs/fs.h>
+#include <errno.h>
#include <stdlib.h>
#include <sys/prctl.h>
#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 @@
* of the License.
*/
+#include <errno.h>
#include <inttypes.h>
#include <traceevent/event-parse.h>
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 @@
#include "syscalltbl.h"
#include "rb_resort.h"
+#include <errno.h>
#include <inttypes.h>
#include <libaudit.h> /* FIXME: Still needed for audit_errno_to_name */
#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 @@
#include "util/debug.h"
#include <api/fs/fs.h>
#include <api/fs/tracing_path.h>
+#include <errno.h>
#include <pthread.h>
#include <stdlib.h>
#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 @@
* permissions. All the event text files are stored there.
*/
+#include <errno.h>
#include <inttypes.h>
#include <stdlib.h>
#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 @@
#include <sys/prctl.h>
#include "tests.h"
#include "debug.h"
+#include <errno.h>
#define NR_ITERS 111
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 @@
+#include <errno.h>
#include <stdio.h>
#include <sys/epoll.h>
#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 @@
*
* Builtin regression testing command: ever growing number of sanity tests
*/
+#include <errno.h>
#include <unistd.h>
#include <string.h>
#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 @@
+#include <errno.h>
#include <linux/kernel.h>
#include <linux/types.h>
#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 @@
#include <linux/compiler.h>
+#include <errno.h>
#include <inttypes.h>
#include <string.h>
#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 @@
#include "parse-events.h"
#include "tests.h"
#include "debug.h"
+#include <errno.h>
#include <linux/kernel.h>
static 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 @@
#include "thread.h"
#include "parse-events.h"
#include "hists_common.h"
+#include <errno.h>
#include <linux/kernel.h>
struct 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 @@
+#include <errno.h>
#include <inttypes.h>
/* For the CLR_() macros */
#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 @@
+#include <errno.h>
#include <inttypes.h>
/* For the CPU_* macros */
#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 @@
#include "thread_map.h"
#include "tests.h"
#include "debug.h"
+#include <errno.h>
#ifndef O_DIRECTORY
#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 @@
+#include <errno.h>
#include <inttypes.h>
#include <api/fs/tracing_path.h>
#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 @@
#include "tests.h"
#include "debug.h"
#include "util.h"
+#include <errno.h>
#include <linux/kernel.h>
#include <linux/hw_breakpoint.h>
#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 @@
+#include <errno.h>
#include <inttypes.h>
/* For the CLR_() macros */
#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 @@
#include "pmu.h"
#include "util.h"
#include "tests.h"
+#include <errno.h>
#include <linux/kernel.h>
/* 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 @@
+#include <errno.h>
#include <stdio.h>
#include <sys/epoll.h>
#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 @@
+#include <errno.h>
#include <inttypes.h>
#include <unistd.h>
#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 @@
#include <sys/time.h>
#include <sys/prctl.h>
+#include <errno.h>
#include <time.h>
#include <stdlib.h>
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 @@
#include "cpumap.h"
#include "tests.h"
+#include <errno.h>
#include <signal.h>
static 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 @@
+#include <errno.h>
#include <inttypes.h>
#include <stdio.h>
#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 @@
* Released under the GPL v2. (and only v2, not any later version)
*/
+#include <errno.h>
#include <inttypes.h>
#include "util.h"
#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 @@
#define __PERF_AUXTRACE_H
#include <sys/types.h>
+#include <errno.h>
#include <stdbool.h>
#include <stddef.h>
#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 @@
#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/string.h>
+#include <errno.h>
#include "perf.h"
#include "debug.h"
#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,
char *buf, size_t size);
#else
+#include <errno.h>
+
static inline struct bpf_object *
bpf__prepare_load(const char *filename __maybe_unused,
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 @@
#include "bpf-loader.h"
#include "bpf-prologue.h"
#include "probe-finder.h"
+#include <errno.h>
#include <dwarf-regs.h>
#include <linux/filter.h>
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,
struct bpf_insn *new_prog, size_t *new_cnt,
size_t cnt_space);
#else
+#include <errno.h>
+
static inline int
bpf__gen_prologue(struct probe_trace_arg *args __maybe_unused,
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 @@
* Copyright (C) 2009, 2010 Arnaldo Carvalho de Melo <acme@redhat.com>
*/
#include "util.h"
+#include <errno.h>
#include <stdio.h>
#include "build-id.h"
#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,
size_t *p_obj_buf_sz);
#else
+#include <errno.h>
static inline void perf_clang__init(void) { }
static 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 @@
+#include <errno.h>
#include <sched.h>
#include "util.h"
#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 @@
#include "comm.h"
#include "util.h"
+#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#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 @@
* Copyright (C) Johannes Schindelin, 2005
*
*/
+#include <errno.h>
#include "util.h"
#include "cache.h"
#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 @@
+#include <errno.h>
#include <stdlib.h>
#include "evsel.h"
#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 @@
* Released under the GPL v2. (and only v2, not any later version)
*/
+#include <errno.h>
#include <inttypes.h>
#include <linux/compiler.h>
#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 @@
#include <linux/kernel.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <errno.h>
#include <unistd.h>
#include <string.h>
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 @@
#include "evlist.h"
#include "evsel.h"
#include "pmu.h"
+#include <errno.h>
static int
perf_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 @@
#include <linux/kernel.h>
#include <sys/time.h>
#include <sys/resource.h>
+#include <errno.h>
#include "symbol.h"
#include "dso.h"
#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 @@
*
*/
+#include <errno.h>
#include <inttypes.h>
#include <stdbool.h>
#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 @@
#include "cpumap.h"
#include "env.h"
#include "util.h"
+#include <errno.h>
struct perf_env perf_env;
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 @@
+#include <errno.h>
#include <inttypes.h>
#include <linux/kernel.h>
#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 @@
*/
#include "util.h"
#include <api/fs/fs.h>
+#include <errno.h>
#include <inttypes.h>
#include <poll.h>
#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 @@
*/
#include <byteswap.h>
+#include <errno.h>
#include <inttypes.h>
#include <linux/bitops.h>
#include <api/fs/tracing_path.h>
--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 @@
+#include <errno.h>
#include <inttypes.h>
#include "util.h"
#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 @@
#include "annotate.h"
#include "srcline.h"
#include "ui/progress.h"
+#include <errno.h>
#include <math.h>
static 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 @@
*/
#include <endian.h>
+#include <errno.h>
#include <byteswap.h>
#include <inttypes.h>
#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 @@
#include <sys/sysmacros.h>
#include <sys/types.h>
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#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 @@
+#include <errno.h>
#include <lzma.h>
#include <stdio.h>
#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 @@
+#include <errno.h>
#include <inttypes.h>
#include "callchain.h"
#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 @@
+#include <errno.h>
#include <inttypes.h>
#include <linux/list.h>
#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 @@
#include <linux/hw_breakpoint.h>
#include <linux/err.h>
+#include <errno.h>
#include "util.h"
#include "../perf.h"
#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 @@
#include <linux/list.h>
#include <linux/compiler.h>
#include <sys/types.h>
+#include <errno.h>
#include <unistd.h>
#include <stdio.h>
#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 @@
* GNU General Public License for more details.
*
*/
+#include <errno.h>
#include <sys/uio.h>
#include "util.h"
#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 @@
+#include <errno.h>
#include <stdlib.h>
#include "strbuf.h"
#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 @@
#include "evsel.h"
#include "cpumap.h"
#include "parse-events.h"
+#include <errno.h>
#include <api/fs/fs.h>
#include "util.h"
#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 @@
+#include <errno.h>
#include <inttypes.h>
#include <linux/kernel.h>
#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 @@
+#include <errno.h>
#include <inttypes.h>
#include <sys/mman.h>
#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 @@
+#include <errno.h>
#include <inttypes.h>
#include <math.h>
#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 @@
#include "debug.h"
#include "util.h"
#include <linux/kernel.h>
+#include <errno.h>
int prefixcmp(const char *str, const char *prefix)
{
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 @@
#include "string2.h"
#include "strfilter.h"
+#include <errno.h>
#include "sane_ctype.h"
/* 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 @@
#include "symbol.h"
#include "util.h"
+#include <errno.h>
#include <stdio.h>
#include <fcntl.h>
#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 @@
#include <linux/rbtree.h>
#include <linux/list.h>
+#include <errno.h>
#include "thread.h"
#include "event.h"
#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 @@
#include "../perf.h"
+#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#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 @@
#include <dirent.h>
+#include <errno.h>
#include <limits.h>
#include <stdbool.h>
#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 @@
*/
#include <elf.h>
+#include <errno.h>
#include <gelf.h>
#include <fcntl.h>
#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 @@
#include <stdarg.h>
#include <string.h>
#include <term.h>
-#include <errno.h>
#include <limits.h>
#include <sys/param.h>
#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 @@
-
+#include <errno.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 20/28] perf str{filter,list}: Disentangle headers
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
` (18 preceding siblings ...)
2017-04-19 16:17 ` [PATCH 19/28] perf tools: Include errno.h where needed Arnaldo Carvalho de Melo
@ 2017-04-19 16:17 ` Arnaldo Carvalho de Melo
2017-04-19 16:17 ` [PATCH 21/28] perf tools: Don't include terminal handling headers in util.h Arnaldo Carvalho de Melo
` (8 subsequent siblings)
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
There are places where we just need a forward declaration, and others
were we need to include strlist.h and/or strfilter.h, reducing the
impact of changes in headers on the build time, do it.
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-zab42gbiki88y9k0csorxekb@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-report.c | 1 -
tools/perf/builtin-timechart.c | 1 -
tools/perf/util/bpf-loader.c | 1 +
tools/perf/util/build-id.c | 1 +
tools/perf/util/build-id.h | 4 +++-
tools/perf/util/evsel_fprintf.c | 1 +
tools/perf/util/jitdump.c | 1 -
tools/perf/util/map.c | 1 -
tools/perf/util/parse-events.c | 1 +
tools/perf/util/probe-event.c | 1 +
tools/perf/util/probe-event.h | 7 +++++--
tools/perf/util/probe-file.c | 1 +
tools/perf/util/probe-file.h | 6 ++++--
tools/perf/util/probe-finder.c | 1 +
tools/perf/util/sort.c | 1 +
tools/perf/util/sort.h | 1 -
tools/perf/util/util.h | 3 ++-
17 files changed, 22 insertions(+), 11 deletions(-)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 2941d8df4d40..f50738e0006e 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -16,7 +16,6 @@
#include <linux/rbtree.h>
#include "util/symbol.h"
#include "util/callchain.h"
-#include "util/strlist.h"
#include "util/values.h"
#include "perf.h"
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index e2576c8f6d4e..38e2c437b7b3 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -30,7 +30,6 @@
#include <linux/time64.h>
#include "util/symbol.h"
#include "util/callchain.h"
-#include "util/strlist.h"
#include "perf.h"
#include "util/header.h"
diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
index bf21c1ca9771..4bd2d1d882af 100644
--- a/tools/perf/util/bpf-loader.c
+++ b/tools/perf/util/bpf-loader.c
@@ -19,6 +19,7 @@
#include "probe-event.h"
#include "probe-finder.h" // for MAX_PROBES
#include "parse-events.h"
+#include "strfilter.h"
#include "llvm-utils.h"
#include "c++/clang-c.h"
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index 8d8ef1d31b1e..f9ccd053cdf6 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -19,6 +19,7 @@
#include "header.h"
#include "vdso.h"
#include "probe-file.h"
+#include "strlist.h"
#include "sane_ctype.h"
diff --git a/tools/perf/util/build-id.h b/tools/perf/util/build-id.h
index d27990610f9f..a96081121179 100644
--- a/tools/perf/util/build-id.h
+++ b/tools/perf/util/build-id.h
@@ -5,7 +5,6 @@
#define SBUILD_ID_SIZE (BUILD_ID_SIZE * 2 + 1)
#include "tool.h"
-#include "strlist.h"
#include <linux/types.h>
extern struct perf_tool build_id__mark_dso_hit_ops;
@@ -34,6 +33,9 @@ char *build_id_cache__origname(const char *sbuild_id);
char *build_id_cache__linkname(const char *sbuild_id, char *bf, size_t size);
char *build_id_cache__cachedir(const char *sbuild_id, const char *name,
bool is_kallsyms, bool is_vdso);
+
+struct strlist;
+
struct strlist *build_id_cache__list_all(bool validonly);
char *build_id_cache__complement(const char *incomplete_sbuild_id);
int build_id_cache__list_build_ids(const char *pathname,
diff --git a/tools/perf/util/evsel_fprintf.c b/tools/perf/util/evsel_fprintf.c
index 8000f62d5d53..e415aee6a245 100644
--- a/tools/perf/util/evsel_fprintf.c
+++ b/tools/perf/util/evsel_fprintf.c
@@ -5,6 +5,7 @@
#include "evsel.h"
#include "callchain.h"
#include "map.h"
+#include "strlist.h"
#include "symbol.h"
static int comma_fprintf(FILE *fp, bool *first, const char *fmt, ...)
diff --git a/tools/perf/util/jitdump.c b/tools/perf/util/jitdump.c
index 388078d84eed..9084930e1757 100644
--- a/tools/perf/util/jitdump.c
+++ b/tools/perf/util/jitdump.c
@@ -17,7 +17,6 @@
#include "debug.h"
#include "evlist.h"
#include "symbol.h"
-#include "strlist.h"
#include <elf.h>
#include "tsc.h"
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 9059d20c3b8a..ebfa5d92358a 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -9,7 +9,6 @@
#include <uapi/linux/mman.h> /* To get things like MAP_HUGETLB even on older libc headers */
#include "map.h"
#include "thread.h"
-#include "strlist.h"
#include "vdso.h"
#include "build-id.h"
#include "util.h"
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index d4877c8438e5..580f0e17ad38 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -9,6 +9,7 @@
#include "parse-events.h"
#include <subcmd/exec-cmd.h>
#include "string2.h"
+#include "strlist.h"
#include "symbol.h"
#include "cache.h"
#include "header.h"
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 8f1374071cfc..84e7e698411e 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -36,6 +36,7 @@
#include "util.h"
#include "event.h"
#include "strlist.h"
+#include "strfilter.h"
#include "debug.h"
#include "cache.h"
#include "color.h"
diff --git a/tools/perf/util/probe-event.h b/tools/perf/util/probe-event.h
index 5d4e94061402..373842656fb6 100644
--- a/tools/perf/util/probe-event.h
+++ b/tools/perf/util/probe-event.h
@@ -3,8 +3,6 @@
#include <stdbool.h>
#include "intlist.h"
-#include "strlist.h"
-#include "strfilter.h"
/* Probe related configurations */
struct probe_conf {
@@ -107,6 +105,8 @@ struct line_range {
struct intlist *line_list; /* Visible lines */
};
+struct strlist;
+
/* List of variables */
struct variable_list {
struct probe_trace_point point; /* Actual probepoint */
@@ -153,6 +153,9 @@ int convert_perf_probe_events(struct perf_probe_event *pevs, int npevs);
int apply_perf_probe_events(struct perf_probe_event *pevs, int npevs);
int show_probe_trace_events(struct perf_probe_event *pevs, int npevs);
void cleanup_perf_probe_events(struct perf_probe_event *pevs, int npevs);
+
+struct strfilter;
+
int del_perf_probe_events(struct strfilter *filter);
int show_perf_probe_event(const char *group, const char *event,
diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
index 1ccaefdc05c4..685653f2bc32 100644
--- a/tools/perf/util/probe-file.c
+++ b/tools/perf/util/probe-file.c
@@ -19,6 +19,7 @@
#include "util.h"
#include "event.h"
#include "strlist.h"
+#include "strfilter.h"
#include "debug.h"
#include "cache.h"
#include "color.h"
diff --git a/tools/perf/util/probe-file.h b/tools/perf/util/probe-file.h
index dbf95a00864a..5ecc9d3925db 100644
--- a/tools/perf/util/probe-file.h
+++ b/tools/perf/util/probe-file.h
@@ -1,10 +1,11 @@
#ifndef __PROBE_FILE_H
#define __PROBE_FILE_H
-#include "strlist.h"
-#include "strfilter.h"
#include "probe-event.h"
+struct strlist;
+struct strfilter;
+
/* Cache of probe definitions */
struct probe_cache_entry {
struct list_head node;
@@ -41,6 +42,7 @@ int probe_file__open_both(int *kfd, int *ufd, int flag);
struct strlist *probe_file__get_namelist(int fd);
struct strlist *probe_file__get_rawlist(int fd);
int probe_file__add_event(int fd, struct probe_trace_event *tev);
+
int probe_file__del_events(int fd, struct strfilter *filter);
int probe_file__get_events(int fd, struct strfilter *filter,
struct strlist *plist);
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 3f3cd11d3b7c..a5731de0e5eb 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -38,6 +38,7 @@
#include "debug.h"
#include "intlist.h"
#include "util.h"
+#include "strlist.h"
#include "symbol.h"
#include "probe-finder.h"
#include "probe-file.h"
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 9aa058e167e8..4df228ab4db1 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -7,6 +7,7 @@
#include "symbol.h"
#include "evsel.h"
#include "evlist.h"
+#include "strlist.h"
#include <traceevent/event-parse.h>
#include "mem-events.h"
#include <linux/kernel.h>
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 535903297cee..421232a27e7b 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -11,7 +11,6 @@
#include "symbol.h"
#include "string.h"
#include "callchain.h"
-#include "strlist.h"
#include "values.h"
#include "../perf.h"
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 6fd9963be1c8..397676c25232 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -40,7 +40,6 @@
#include <termios.h>
#include <linux/bitops.h>
#include <termios.h>
-#include "strlist.h"
extern char buildid_dir[];
@@ -89,6 +88,8 @@ static inline void *zalloc(size_t size)
#define zfree(ptr) ({ free(*ptr); *ptr = NULL; })
+struct strlist;
+
int mkdir_p(char *path, mode_t mode);
int rm_rf(const char *path);
struct strlist *lsdir(const char *name, bool (*filter)(const char *, struct dirent *));
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 21/28] perf tools: Don't include terminal handling headers in util.h
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
` (19 preceding siblings ...)
2017-04-19 16:17 ` [PATCH 20/28] perf str{filter,list}: Disentangle headers Arnaldo Carvalho de Melo
@ 2017-04-19 16:17 ` Arnaldo Carvalho de Melo
2017-04-19 16:17 ` [PATCH 22/28] perf tools: Move path related functions to util/path.h Arnaldo Carvalho de Melo
` (7 subsequent siblings)
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Continuing the disentanglement, mostly the TUI needs CTRL(c), that is
in sys/ttydefaults.h and term.c needs the termios headers.
And term.h needs to be added to a few places too.
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-il19zna7qj9ytavdbwlipc7t@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-kvm.c | 1 +
tools/perf/builtin-top.c | 1 +
tools/perf/ui/browsers/annotate.c | 1 +
| 2 ++
tools/perf/ui/browsers/hists.c | 1 +
tools/perf/util/parse-events.c | 2 +-
tools/perf/util/term.c | 6 +++++-
tools/perf/util/util.h | 4 ----
8 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 40660428fa72..4002277475cf 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -3,6 +3,7 @@
#include "util/evsel.h"
#include "util/evlist.h"
+#include "util/term.h"
#include "util/util.h"
#include "util/cache.h"
#include "util/symbol.h"
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index ec3247db4826..47984a838b73 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -40,6 +40,7 @@
#include "util/cpumap.h"
#include "util/xyarray.h"
#include "util/sort.h"
+#include "util/term.h"
#include "util/intlist.h"
#include "util/parse-branch-options.h"
#include "arch/common.h"
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index 2ed64124276f..d990ad08a3c6 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -12,6 +12,7 @@
#include <inttypes.h>
#include <pthread.h>
#include <linux/kernel.h>
+#include <sys/ttydefaults.h>
struct disasm_line_samples {
double percent;
--git a/tools/perf/ui/browsers/header.c b/tools/perf/ui/browsers/header.c
index edbeaaf31ace..e2c9390ff4c5 100644
--- a/tools/perf/ui/browsers/header.c
+++ b/tools/perf/ui/browsers/header.c
@@ -8,6 +8,8 @@
#include "util/header.h"
#include "util/session.h"
+#include <sys/ttydefaults.h>
+
static void ui_browser__argv_write(struct ui_browser *browser,
void *entry, int row)
{
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 0916575c6694..a271b48ad0d3 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -4,6 +4,7 @@
#include <stdlib.h>
#include <string.h>
#include <linux/rbtree.h>
+#include <sys/ttydefaults.h>
#include "../../util/evsel.h"
#include "../../util/evlist.h"
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 580f0e17ad38..f3dd1aa59a25 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -1,7 +1,7 @@
#include <linux/hw_breakpoint.h>
#include <linux/err.h>
#include <errno.h>
-#include "util.h"
+#include "term.h"
#include "../perf.h"
#include "evlist.h"
#include "evsel.h"
diff --git a/tools/perf/util/term.c b/tools/perf/util/term.c
index 90b47d8aa19c..8f254a74d97d 100644
--- a/tools/perf/util/term.c
+++ b/tools/perf/util/term.c
@@ -1,4 +1,8 @@
-#include "util.h"
+#include "term.h"
+#include <stdlib.h>
+#include <termios.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
void get_term_dimensions(struct winsize *ws)
{
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 397676c25232..fa8c2e59a0bc 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -17,7 +17,6 @@
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
-#include <term.h>
#include <limits.h>
#include <sys/param.h>
#include <sys/types.h>
@@ -35,11 +34,8 @@
#include <sys/ioctl.h>
#include <linux/kernel.h>
#include <linux/types.h>
-#include <sys/ttydefaults.h>
#include <api/fs/tracing_path.h>
-#include <termios.h>
#include <linux/bitops.h>
-#include <termios.h>
extern char buildid_dir[];
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 22/28] perf tools: Move path related functions to util/path.h
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
` (20 preceding siblings ...)
2017-04-19 16:17 ` [PATCH 21/28] perf tools: Don't include terminal handling headers in util.h Arnaldo Carvalho de Melo
@ 2017-04-19 16:17 ` Arnaldo Carvalho de Melo
2017-04-19 16:17 ` [PATCH 23/28] perf tools: No need to include bitops.h in util.h Arnaldo Carvalho de Melo
` (6 subsequent siblings)
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Disentangling util.h header mess a bit more.
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-aj6je8ly377i4upedmjzdsq6@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-trace.c | 1 +
tools/perf/tests/mmap-thread-lookup.c | 1 +
tools/perf/tests/openat-syscall-all-cpus.c | 4 ++++
tools/perf/tests/openat-syscall.c | 3 +++
tools/perf/ui/setup.c | 1 +
tools/perf/util/build-id.c | 1 +
tools/perf/util/counts.c | 1 +
tools/perf/util/dso.c | 1 +
tools/perf/util/path.c | 28 +++++++++++++++++++++++++++-
tools/perf/util/path.h | 9 +++++++++
tools/perf/util/symbol.c | 1 +
tools/perf/util/symbol.h | 2 +-
tools/perf/util/unwind-libdw.c | 1 +
tools/perf/util/util.c | 10 ----------
tools/perf/util/util.h | 16 ----------------
15 files changed, 52 insertions(+), 28 deletions(-)
create mode 100644 tools/perf/util/path.h
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index e065c4a12f58..d1c8cdc6788b 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -24,6 +24,7 @@
#include "util/evlist.h"
#include <subcmd/exec-cmd.h>
#include "util/machine.h"
+#include "util/path.h"
#include "util/session.h"
#include "util/thread.h"
#include <subcmd/parse-options.h>
diff --git a/tools/perf/tests/mmap-thread-lookup.c b/tools/perf/tests/mmap-thread-lookup.c
index a5ffb754f8c6..6ea4d8a5d26b 100644
--- a/tools/perf/tests/mmap-thread-lookup.c
+++ b/tools/perf/tests/mmap-thread-lookup.c
@@ -12,6 +12,7 @@
#include "thread_map.h"
#include "symbol.h"
#include "thread.h"
+#include "util.h"
#define THREADS 4
diff --git a/tools/perf/tests/openat-syscall-all-cpus.c b/tools/perf/tests/openat-syscall-all-cpus.c
index b7dece0de42c..1a74dd9fd067 100644
--- a/tools/perf/tests/openat-syscall-all-cpus.c
+++ b/tools/perf/tests/openat-syscall-all-cpus.c
@@ -3,8 +3,12 @@
/* For the CPU_* macros */
#include <pthread.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include <api/fs/fs.h>
#include <linux/err.h>
+#include <api/fs/tracing_path.h>
#include "evsel.h"
#include "tests.h"
#include "thread_map.h"
diff --git a/tools/perf/tests/openat-syscall.c b/tools/perf/tests/openat-syscall.c
index 5f0c700b4693..e44506e21ee7 100644
--- a/tools/perf/tests/openat-syscall.c
+++ b/tools/perf/tests/openat-syscall.c
@@ -2,6 +2,9 @@
#include <inttypes.h>
#include <api/fs/tracing_path.h>
#include <linux/err.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include "thread_map.h"
#include "evsel.h"
#include "debug.h"
diff --git a/tools/perf/ui/setup.c b/tools/perf/ui/setup.c
index 50d13e58210f..5ea0b40c4fc2 100644
--- a/tools/perf/ui/setup.c
+++ b/tools/perf/ui/setup.c
@@ -4,6 +4,7 @@
#include "../util/cache.h"
#include "../util/debug.h"
#include "../util/hist.h"
+#include "../util/util.h"
pthread_mutex_t ui__lock = PTHREAD_MUTEX_INITIALIZER;
void *perf_gtk_handle;
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index f9ccd053cdf6..b5c4892c2e18 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -18,6 +18,7 @@
#include "tool.h"
#include "header.h"
#include "vdso.h"
+#include "path.h"
#include "probe-file.h"
#include "strlist.h"
diff --git a/tools/perf/util/counts.c b/tools/perf/util/counts.c
index 83fedd0d22a1..c4af82ab7808 100644
--- a/tools/perf/util/counts.c
+++ b/tools/perf/util/counts.c
@@ -2,6 +2,7 @@
#include <stdlib.h>
#include "evsel.h"
#include "counts.h"
+#include "util.h"
struct perf_counts *perf_counts__new(int ncpus, int nthreads)
{
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index cd061dc1de70..cbfe17f5168a 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -3,6 +3,7 @@
#include <sys/time.h>
#include <sys/resource.h>
#include <errno.h>
+#include "path.h"
#include "symbol.h"
#include "dso.h"
#include "machine.h"
diff --git a/tools/perf/util/path.c b/tools/perf/util/path.c
index 7c7630be5a89..50ec3bc87a60 100644
--- a/tools/perf/util/path.c
+++ b/tools/perf/util/path.c
@@ -11,8 +11,13 @@
* which is what it's designed for.
*/
#include "cache.h"
-#include "util.h"
+#include "path.h"
+#include <linux/kernel.h>
#include <limits.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
static char bad_path[] = "/bad-path/";
/*
@@ -50,3 +55,24 @@ char *mkpath(const char *fmt, ...)
return bad_path;
return cleanup_path(pathname);
}
+
+int path__join(char *bf, size_t size, const char *path1, const char *path2)
+{
+ return scnprintf(bf, size, "%s%s%s", path1, path1[0] ? "/" : "", path2);
+}
+
+int path__join3(char *bf, size_t size, const char *path1, const char *path2, const char *path3)
+{
+ return scnprintf(bf, size, "%s%s%s%s%s", path1, path1[0] ? "/" : "",
+ path2, path2[0] ? "/" : "", path3);
+}
+
+bool is_regular_file(const char *file)
+{
+ struct stat st;
+
+ if (stat(file, &st))
+ return false;
+
+ return S_ISREG(st.st_mode);
+}
diff --git a/tools/perf/util/path.h b/tools/perf/util/path.h
new file mode 100644
index 000000000000..9a276a58e3c2
--- /dev/null
+++ b/tools/perf/util/path.h
@@ -0,0 +1,9 @@
+#ifndef _PERF_PATH_H
+#define _PERF_PATH_H
+
+int path__join(char *bf, size_t size, const char *path1, const char *path2);
+int path__join3(char *bf, size_t size, const char *path1, const char *path2, const char *path3);
+
+bool is_regular_file(const char *file);
+
+#endif /* _PERF_PATH_H */
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 68f14d770083..2cb7665e9973 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -19,6 +19,7 @@
#include "strlist.h"
#include "intlist.h"
#include "header.h"
+#include "path.h"
#include "sane_ctype.h"
#include <elf.h>
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 5245d2fb1a0a..7acd70fce68e 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -13,7 +13,7 @@
#include <libgen.h>
#include "build-id.h"
#include "event.h"
-#include "util.h"
+#include "path.h"
#ifdef HAVE_LIBELF_SUPPORT
#include <libelf.h>
diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c
index 783a53fb7a4e..f90e11a555b2 100644
--- a/tools/perf/util/unwind-libdw.c
+++ b/tools/perf/util/unwind-libdw.c
@@ -12,6 +12,7 @@
#include "event.h"
#include "perf_regs.h"
#include "callchain.h"
+#include "util.h"
static char *debuginfo_path;
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 4fb8ee552a31..64877c6d09b2 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -713,16 +713,6 @@ const char *perf_tip(const char *dirpath)
return tip;
}
-bool is_regular_file(const char *file)
-{
- struct stat st;
-
- if (stat(file, &st))
- return false;
-
- return S_ISREG(st.st_mode);
-}
-
int fetch_current_timestamp(char *buf, size_t sz)
{
struct timeval tv;
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index fa8c2e59a0bc..617965644ff4 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -120,21 +120,6 @@ struct parse_tag {
unsigned long parse_tag_value(const char *str, struct parse_tag *tags);
-static inline int path__join(char *bf, size_t size,
- const char *path1, const char *path2)
-{
- return scnprintf(bf, size, "%s%s%s", path1, path1[0] ? "/" : "", path2);
-}
-
-static inline int path__join3(char *bf, size_t size,
- const char *path1, const char *path2,
- const char *path3)
-{
- return scnprintf(bf, size, "%s%s%s%s%s",
- path1, path1[0] ? "/" : "",
- path2, path2[0] ? "/" : "", path3);
-}
-
int perf_event_paranoid(void);
void mem_bswap_64(void *src, int byte_size);
@@ -162,7 +147,6 @@ int fetch_kernel_version(unsigned int *puint,
#define KVER_PARAM(x) KVER_VERSION(x), KVER_PATCHLEVEL(x), KVER_SUBLEVEL(x)
const char *perf_tip(const char *dirpath);
-bool is_regular_file(const char *file);
int fetch_current_timestamp(char *buf, size_t sz);
#ifndef HAVE_SCHED_GETCPU_SUPPORT
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 23/28] perf tools: No need to include bitops.h in util.h
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
` (21 preceding siblings ...)
2017-04-19 16:17 ` [PATCH 22/28] perf tools: Move path related functions to util/path.h Arnaldo Carvalho de Melo
@ 2017-04-19 16:17 ` Arnaldo Carvalho de Melo
2017-04-19 16:17 ` [PATCH 24/28] perf tools: Use api/fs/tracing_path.h where needed Arnaldo Carvalho de Melo
` (5 subsequent siblings)
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
When we switched to the kernel's roundup_pow_of_two we forgot to remove
this include from util.h, do it now.
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>
Fixes: 91529834d1de ("perf evlist: Use roundup_pow_of_two")
Link: http://lkml.kernel.org/n/tip-kfye5rxivib6155cltx0bw4h@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/util.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 617965644ff4..423ed7f8bcc0 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -35,7 +35,6 @@
#include <linux/kernel.h>
#include <linux/types.h>
#include <api/fs/tracing_path.h>
-#include <linux/bitops.h>
extern char buildid_dir[];
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 24/28] perf tools: Use api/fs/tracing_path.h where needed
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
` (22 preceding siblings ...)
2017-04-19 16:17 ` [PATCH 23/28] perf tools: No need to include bitops.h in util.h Arnaldo Carvalho de Melo
@ 2017-04-19 16:17 ` Arnaldo Carvalho de Melo
2017-04-19 16:17 ` [PATCH 25/28] perf tools: Remove misplaced __maybe_unused in some functions Arnaldo Carvalho de Melo
` (4 subsequent siblings)
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Instead of getting it out of luck from util.h, where it isn't needed at
all.
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-0bqugg5lc5ksla1v4m0dnmc1@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-ftrace.c | 1 +
tools/perf/tests/parse-events.c | 1 +
tools/perf/util/util.h | 1 -
3 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
index 67d14037c03e..0f34ab7a9ec1 100644
--- a/tools/perf/builtin-ftrace.c
+++ b/tools/perf/builtin-ftrace.c
@@ -16,6 +16,7 @@
#include "debug.h"
#include <subcmd/parse-options.h>
+#include <api/fs/tracing_path.h>
#include "evlist.h"
#include "target.h"
#include "cpumap.h"
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 66ecc3f5f618..f5b77f5c3192 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -9,6 +9,7 @@
#include <linux/kernel.h>
#include <linux/hw_breakpoint.h>
#include <api/fs/fs.h>
+#include <api/fs/tracing_path.h>
#define PERF_TP_SAMPLE_TYPE (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | \
PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD)
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 423ed7f8bcc0..d4910e490f20 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -34,7 +34,6 @@
#include <sys/ioctl.h>
#include <linux/kernel.h>
#include <linux/types.h>
-#include <api/fs/tracing_path.h>
extern char buildid_dir[];
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 25/28] perf tools: Remove misplaced __maybe_unused in some functions
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
` (23 preceding siblings ...)
2017-04-19 16:17 ` [PATCH 24/28] perf tools: Use api/fs/tracing_path.h where needed Arnaldo Carvalho de Melo
@ 2017-04-19 16:17 ` Arnaldo Carvalho de Melo
2017-04-19 16:17 ` [PATCH 26/28] perf tools: Remove include dirent.h from util.h Arnaldo Carvalho de Melo
` (3 subsequent siblings)
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:17 UTC (permalink / raw)
To: Ingo Molnar; +Cc: linux-kernel, Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Those args _are_ being used.
Link: http://lkml.kernel.org/n/tip-yi9s00ki1i1tcc704v042957@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/build-id.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index b5c4892c2e18..9815a3b6667a 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -451,14 +451,14 @@ void disable_buildid_cache(void)
}
static bool lsdir_bid_head_filter(const char *name __maybe_unused,
- struct dirent *d __maybe_unused)
+ struct dirent *d)
{
return (strlen(d->d_name) == 2) &&
isxdigit(d->d_name[0]) && isxdigit(d->d_name[1]);
}
static bool lsdir_bid_tail_filter(const char *name __maybe_unused,
- struct dirent *d __maybe_unused)
+ struct dirent *d)
{
int i = 0;
while (isxdigit(d->d_name[i]) && i < SBUILD_ID_SIZE - 3)
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 26/28] perf tools: Remove include dirent.h from util.h
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
` (24 preceding siblings ...)
2017-04-19 16:17 ` [PATCH 25/28] perf tools: Remove misplaced __maybe_unused in some functions Arnaldo Carvalho de Melo
@ 2017-04-19 16:17 ` Arnaldo Carvalho de Melo
2017-04-19 16:17 ` [PATCH 27/28] perf tools: Remove regex.h and fnmatch.h " Arnaldo Carvalho de Melo
` (2 subsequent siblings)
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
The files using the dirent.h routines should instead include it,
reducing the includes hell that lead to longer build times.
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-42g2f4z6nfg7mdb2ae97n7tj@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-script.c | 1 +
tools/perf/tests/dso-data.c | 1 +
tools/perf/tests/parse-events.c | 1 +
tools/perf/ui/browsers/hists.c | 1 +
tools/perf/util/build-id.c | 1 +
tools/perf/util/cpumap.c | 1 +
tools/perf/util/event.c | 1 +
tools/perf/util/machine.c | 1 +
tools/perf/util/parse-events.c | 1 +
tools/perf/util/util.c | 1 +
tools/perf/util/util.h | 2 +-
11 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 853651a0f720..fe1dcd4f2c6d 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -32,6 +32,7 @@
#include "asm/bug.h"
#include "util/mem-events.h"
#include "util/dump-insn.h"
+#include <dirent.h>
#include <errno.h>
#include <inttypes.h>
diff --git a/tools/perf/tests/dso-data.c b/tools/perf/tests/dso-data.c
index 46ea2e061b86..8f08df5861cb 100644
--- a/tools/perf/tests/dso-data.c
+++ b/tools/perf/tests/dso-data.c
@@ -1,3 +1,4 @@
+#include <dirent.h>
#include <stdlib.h>
#include <linux/kernel.h>
#include <linux/types.h>
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index f5b77f5c3192..981d2bf9914f 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -5,6 +5,7 @@
#include "tests.h"
#include "debug.h"
#include "util.h"
+#include <dirent.h>
#include <errno.h>
#include <linux/kernel.h>
#include <linux/hw_breakpoint.h>
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index a271b48ad0d3..f0b5b2b0e521 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1,3 +1,4 @@
+#include <dirent.h>
#include <errno.h>
#include <inttypes.h>
#include <stdio.h>
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index 9815a3b6667a..923ea290bb6e 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -7,6 +7,7 @@
* Copyright (C) 2009, 2010 Arnaldo Carvalho de Melo <acme@redhat.com>
*/
#include "util.h"
+#include <dirent.h>
#include <errno.h>
#include <stdio.h>
#include "build-id.h"
diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c
index 9d9ecb2430cc..37b3bb79ee08 100644
--- a/tools/perf/util/cpumap.c
+++ b/tools/perf/util/cpumap.c
@@ -3,6 +3,7 @@
#include "../perf.h"
#include "cpumap.h"
#include <assert.h>
+#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <linux/bitmap.h>
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 1fc1217a0c2c..cf457ef534da 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -1,3 +1,4 @@
+#include <dirent.h>
#include <errno.h>
#include <inttypes.h>
#include <linux/kernel.h>
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index cdbfe3e32e5a..46411742d03c 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1,3 +1,4 @@
+#include <dirent.h>
#include <errno.h>
#include <inttypes.h>
#include "callchain.h"
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index f3dd1aa59a25..7d84338b19ee 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -1,5 +1,6 @@
#include <linux/hw_breakpoint.h>
#include <linux/err.h>
+#include <dirent.h>
#include <errno.h>
#include "term.h"
#include "../perf.h"
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 64877c6d09b2..b9716bc6e8fd 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -7,6 +7,7 @@
#ifdef HAVE_BACKTRACE_SUPPORT
#include <execinfo.h>
#endif
+#include <dirent.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index d4910e490f20..c0574e2763b7 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -20,7 +20,6 @@
#include <limits.h>
#include <sys/param.h>
#include <sys/types.h>
-#include <dirent.h>
#include <sys/time.h>
#include <time.h>
#include <signal.h>
@@ -82,6 +81,7 @@ static inline void *zalloc(size_t size)
#define zfree(ptr) ({ free(*ptr); *ptr = NULL; })
+struct dirent;
struct strlist;
int mkdir_p(char *path, mode_t mode);
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 27/28] perf tools: Remove regex.h and fnmatch.h from util.h
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
` (25 preceding siblings ...)
2017-04-19 16:17 ` [PATCH 26/28] perf tools: Remove include dirent.h from util.h Arnaldo Carvalho de Melo
@ 2017-04-19 16:17 ` Arnaldo Carvalho de Melo
2017-04-19 16:17 ` [PATCH 28/28] perf tools: Ditch unused strchrnul() reimplementation Arnaldo Carvalho de Melo
2017-04-20 8:10 ` [GIT PULL 00/28] perf/core fixes and cleanups Ingo Molnar
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
The users of regex and fnmatch functions should include those headers
instead.
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-ixzm5kuamsq1ixbkuv6kmwzj@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-report.c | 1 +
tools/perf/util/machine.c | 1 +
tools/perf/util/sort.c | 1 +
tools/perf/util/sort.h | 2 +-
tools/perf/util/util.h | 2 --
5 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index f50738e0006e..5bbd4b2ef6d2 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -41,6 +41,7 @@
#include <dlfcn.h>
#include <errno.h>
#include <inttypes.h>
+#include <regex.h>
#include <linux/bitmap.h>
#include <linux/stringify.h>
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 46411742d03c..988e84ce6f88 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1,6 +1,7 @@
#include <dirent.h>
#include <errno.h>
#include <inttypes.h>
+#include <regex.h>
#include "callchain.h"
#include "debug.h"
#include "event.h"
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 4df228ab4db1..fe4fd7b5f8e0 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1,5 +1,6 @@
#include <errno.h>
#include <inttypes.h>
+#include <regex.h>
#include <sys/mman.h>
#include "sort.h"
#include "hist.h"
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 421232a27e7b..8bcec05ee578 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -2,7 +2,7 @@
#define __PERF_SORT_H
#include "../builtin.h"
-#include "util.h"
+#include <regex.h>
#include "color.h"
#include <linux/list.h>
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index c0574e2763b7..d79f3c23dd02 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -23,9 +23,7 @@
#include <sys/time.h>
#include <time.h>
#include <signal.h>
-#include <fnmatch.h>
#include <assert.h>
-#include <regex.h>
#include <utime.h>
#include <sys/wait.h>
#include <poll.h>
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 28/28] perf tools: Ditch unused strchrnul() reimplementation
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
` (26 preceding siblings ...)
2017-04-19 16:17 ` [PATCH 27/28] perf tools: Remove regex.h and fnmatch.h " Arnaldo Carvalho de Melo
@ 2017-04-19 16:17 ` Arnaldo Carvalho de Melo
2017-04-20 8:10 ` [GIT PULL 00/28] perf/core fixes and cleanups Ingo Molnar
28 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-19 16:17 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Remnants from the git codebase.
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-kwaez3uxo1w9f8v5r7etl0w6@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/util.h | 16 ----------------
1 file changed, 16 deletions(-)
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index d79f3c23dd02..2a1166f8bb37 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -56,22 +56,6 @@ void set_warning_routine(void (*routine)(const char *err, va_list params));
int prefixcmp(const char *str, const char *prefix);
void set_buildid_dir(const char *dir);
-#ifdef __GLIBC_PREREQ
-#if __GLIBC_PREREQ(2, 1)
-#define HAVE_STRCHRNUL
-#endif
-#endif
-
-#ifndef HAVE_STRCHRNUL
-#define strchrnul gitstrchrnul
-static inline char *gitstrchrnul(const char *s, int c)
-{
- while (*s && *s != c)
- s++;
- return (char *)s;
-}
-#endif
-
static inline void *zalloc(size_t size)
{
return calloc(1, size);
--
2.9.3
^ permalink raw reply related [flat|nested] 35+ messages in thread
* Re: [GIT PULL 00/28] perf/core fixes and cleanups
2017-04-19 16:16 [GIT PULL 00/28] perf/core fixes and cleanups Arnaldo Carvalho de Melo
` (27 preceding siblings ...)
2017-04-19 16:17 ` [PATCH 28/28] perf tools: Ditch unused strchrnul() reimplementation Arnaldo Carvalho de Melo
@ 2017-04-20 8:10 ` Ingo Molnar
2017-04-20 11:24 ` Arnaldo Carvalho de Melo
28 siblings, 1 reply; 35+ messages in thread
From: Ingo Molnar @ 2017-04-20 8:10 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: linux-kernel, Adrian Hunter, David Ahern, Jean Pihet, Jiri Olsa,
Josh Poimboeuf, Namhyung Kim, Wang Nan, Arnaldo Carvalho de Melo
* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> Hi Ingo,
>
> Please consider pulling,
>
> - Arnaldo
>
> Test results at the end of this message, as usual.
>
> The following changes since commit e720c19e0d5412f45736d62258d21dc7b056c4ad:
>
> Merge tag 'perf-core-for-mingo-4.12-20170413' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2017-04-17 10:11:09 +0200)
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-4.12-20170419
>
> for you to fetch changes up to 1b5ad16c7aa7177512ce141e345ff36b9f1a6136:
>
> perf tools: Ditch unused strchrnul() reimplementation (2017-04-19 13:01:57 -0300)
>
> ----------------------------------------------------------------
> perf/core cleanups: (Arnaldo Carvalho de Melo)
>
> . Introduce new header files out of the hodge-podge that util/util.h
> became, trying to disentangle the includes hell that all C projects
> end up growing. This should help in build times, as changes to
> seemingly unrelated files (util.h included tons of headers) won't
> trigger a rebuild of most object files.
>
> . Use equivalent facilities found in the kernel source code base
> originated tools/include/ header files, such as __stringify(),
> ARRAY_SIZE, that has extra checks (__must_be_array()), etc.
>
> . For that get some more files from the kernel sources, like
> include/linux/bug.h, some just with the bits needed at this time.
>
> . Use the headers where facilities declared in them are used, such
> as PRIxu(32,64) macros (inttypes.h), errno defines (errno.h), etc.
>
> . Remove various leftovers from the initial code base we copied from
> git.git: FLEX_ARRAY, etc.
>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> ----------------------------------------------------------------
> Arnaldo Carvalho de Melo (28):
> perf unwind arm64: Add missing errno.h header
> perf tools: Remove FLEX_ARRAY definition
> tools include: Introduce linux/bug.h, from the kernel sources
> tools include: Adopt __same_type() and __must_be_array() from the kernel
> tools include: Move ARRAY_SIZE() to linux/kernel.h
> perf tools: Add include <linux/kernel.h> where ARRAY_SIZE() is used
> objtool: Drop ARRAY_SIZE() definition, tools/include/linux/kernel.h has it now
> tools include: Drop ARRAY_SIZE() definition from linux/hashtable.h
> perf tools: Remove unused macros from util.h
> perf tools: Including missing inttypes.h header
> perf tools: Remove PRI[xu] macros from perf.h
> perf tools: Replace STR() calls with __stringify()
> perf tools: Ditch unused PATH_SEP, STRIP_EXTENSION
> perf tools: Move sane ctype stuff from util.h to sane_ctype.h
> tools include: Include missing headers for fls() and types in linux/log2.h
> perf tools: Move print_binary definitions to separate files
> perf tools: Move srcline definitions to separate header
> perf tools: Move extra string util functions to util/string2.h
> perf tools: Include errno.h where needed
> perf str{filter,list}: Disentangle headers
> perf tools: Don't include terminal handling headers in util.h
> perf tools: Move path related functions to util/path.h
> perf tools: No need to include bitops.h in util.h
> perf tools: Use api/fs/tracing_path.h where needed
> perf tools: Remove misplaced __maybe_unused in some functions
> perf tools: Remove include dirent.h from util.h
> perf tools: Remove regex.h and fnmatch.h from util.h
> perf tools: Ditch unused strchrnul() reimplementation
>
> tools/include/linux/bug.h | 10 +
> tools/include/linux/compiler-gcc.h | 3 +
> tools/include/linux/compiler.h | 5 +
> tools/include/linux/hashtable.h | 4 -
> tools/include/linux/kernel.h | 3 +
> tools/include/linux/log2.h | 3 +
> tools/lib/symbol/kallsyms.c | 1 +
> tools/objtool/builtin-check.c | 3 +-
> tools/objtool/objtool.c | 3 +-
> tools/perf/MANIFEST | 1 +
> tools/perf/arch/arm/util/dwarf-regs.c | 4 +-
> tools/perf/arch/arm64/util/dwarf-regs.c | 4 +-
> tools/perf/arch/arm64/util/unwind-libunwind.c | 2 +-
> tools/perf/arch/common.c | 2 +
> tools/perf/arch/powerpc/util/dwarf-regs.c | 5 +-
> tools/perf/arch/powerpc/util/kvm-stat.c | 1 +
> tools/perf/arch/powerpc/util/perf_regs.c | 1 +
> tools/perf/arch/s390/util/kvm-stat.c | 1 +
> tools/perf/arch/x86/tests/intel-cqm.c | 1 +
> tools/perf/arch/x86/tests/perf-time-to-tsc.c | 2 +
> tools/perf/arch/x86/util/auxtrace.c | 1 +
> tools/perf/arch/x86/util/intel-bts.c | 1 +
> tools/perf/arch/x86/util/intel-pt.c | 1 +
> tools/perf/arch/x86/util/kvm-stat.c | 1 +
> tools/perf/arch/x86/util/perf_regs.c | 1 +
> tools/perf/bench/mem-functions.c | 1 +
> tools/perf/bench/numa.c | 2 +
> tools/perf/builtin-annotate.c | 1 +
> tools/perf/builtin-buildid-cache.c | 1 +
> tools/perf/builtin-buildid-list.c | 1 +
> tools/perf/builtin-c2c.c | 2 +
> tools/perf/builtin-diff.c | 2 +
> tools/perf/builtin-ftrace.c | 2 +
> tools/perf/builtin-help.c | 6 +-
> tools/perf/builtin-inject.c | 1 +
> tools/perf/builtin-kallsyms.c | 1 +
> tools/perf/builtin-kmem.c | 5 +
> tools/perf/builtin-kvm.c | 4 +
> tools/perf/builtin-lock.c | 3 +
> tools/perf/builtin-mem.c | 1 +
> tools/perf/builtin-record.c | 2 +
> tools/perf/builtin-report.c | 4 +-
> tools/perf/builtin-sched.c | 5 +
> tools/perf/builtin-script.c | 8 +
> tools/perf/builtin-stat.c | 5 +
> tools/perf/builtin-timechart.c | 4 +-
> tools/perf/builtin-top.c | 3 +
> tools/perf/builtin-trace.c | 8 +
> tools/perf/perf.c | 12 +-
> tools/perf/tests/attr.c | 2 +
> tools/perf/tests/backward-ring-buffer.c | 1 +
> tools/perf/tests/bpf.c | 2 +
> tools/perf/tests/builtin-test.c | 2 +
> tools/perf/tests/clang.c | 1 +
> tools/perf/tests/code-reading.c | 6 +-
> tools/perf/tests/dso-data.c | 2 +
> tools/perf/tests/dwarf-unwind.c | 1 +
> tools/perf/tests/event-times.c | 2 +
> tools/perf/tests/evsel-roundtrip-name.c | 2 +
> tools/perf/tests/hists_common.c | 2 +
> tools/perf/tests/hists_cumulate.c | 1 +
> tools/perf/tests/hists_filter.c | 1 +
> tools/perf/tests/hists_link.c | 2 +
> tools/perf/tests/hists_output.c | 1 +
> tools/perf/tests/is_printable_array.c | 3 +-
> tools/perf/tests/mmap-basic.c | 3 +
> tools/perf/tests/mmap-thread-lookup.c | 2 +
> tools/perf/tests/openat-syscall-all-cpus.c | 6 +
> tools/perf/tests/openat-syscall-tp-fields.c | 1 +
> tools/perf/tests/openat-syscall.c | 5 +
> tools/perf/tests/parse-events.c | 5 +-
> tools/perf/tests/parse-no-sample-id-all.c | 1 +
> tools/perf/tests/perf-record.c | 2 +
> tools/perf/tests/pmu.c | 2 +
> tools/perf/tests/sample-parsing.c | 2 +
> tools/perf/tests/sdt.c | 1 +
> tools/perf/tests/sw-clock.c | 2 +
> tools/perf/tests/switch-tracking.c | 1 +
> tools/perf/tests/task-exit.c | 1 +
> tools/perf/tests/unit_number__scnprintf.c | 1 +
> tools/perf/tests/vmlinux-kallsyms.c | 1 +
> tools/perf/ui/browser.c | 2 +
> tools/perf/ui/browsers/annotate.c | 3 +
> tools/perf/ui/browsers/header.c | 2 +
> tools/perf/ui/browsers/hists.c | 8 +
> tools/perf/ui/browsers/map.c | 2 +
> tools/perf/ui/gtk/annotate.c | 2 +-
> tools/perf/ui/gtk/hists.c | 1 +
> tools/perf/ui/hist.c | 1 +
> tools/perf/ui/setup.c | 1 +
> tools/perf/ui/stdio/hist.c | 4 +-
> tools/perf/ui/tui/setup.c | 1 +
> tools/perf/util/Build | 1 +
> tools/perf/util/annotate.c | 6 +
> tools/perf/util/auxtrace.c | 6 +-
> tools/perf/util/auxtrace.h | 1 +
> tools/perf/util/bpf-loader.c | 3 +
> tools/perf/util/bpf-loader.h | 2 +
> tools/perf/util/bpf-prologue.c | 1 +
> tools/perf/util/bpf-prologue.h | 2 +
> tools/perf/util/build-id.c | 9 +-
> tools/perf/util/build-id.h | 4 +-
> tools/perf/util/c++/clang-c.h | 1 +
> tools/perf/util/callchain.c | 1 +
> tools/perf/util/cgroup.c | 5 +-
> tools/perf/util/cloexec.c | 1 +
> tools/perf/util/comm.c | 1 +
> tools/perf/util/config.c | 3 +
> tools/perf/util/counts.c | 2 +
> tools/perf/util/cpumap.c | 3 +
> tools/perf/util/ctype.c | 2 +-
> tools/perf/util/data-convert-bt.c | 4 +
> tools/perf/util/data.c | 1 +
> tools/perf/util/debug.c | 4 +
> tools/perf/util/demangle-java.c | 2 +
> tools/perf/util/drv_configs.c | 1 +
> tools/perf/util/dso.c | 4 +
> tools/perf/util/dwarf-aux.c | 3 +
> tools/perf/util/dwarf-regs.c | 1 +
> tools/perf/util/env.c | 1 +
> tools/perf/util/event.c | 7 +-
> tools/perf/util/evlist.c | 2 +
> tools/perf/util/evlist.h | 1 +
> tools/perf/util/evsel.c | 4 +
> tools/perf/util/evsel_fprintf.c | 2 +
> tools/perf/util/header.c | 5 +
> tools/perf/util/hist.c | 2 +
> tools/perf/util/intel-bts.c | 2 +
> tools/perf/util/intel-pt.c | 1 +
> tools/perf/util/jitdump.c | 7 +-
> tools/perf/util/lzma.c | 1 +
> tools/perf/util/machine.c | 8 +-
> tools/perf/util/map.c | 2 +-
> tools/perf/util/mem-events.c | 1 +
> tools/perf/util/ordered-events.c | 2 +
> tools/perf/util/parse-events.c | 7 +-
> tools/perf/util/path.c | 28 ++-
> tools/perf/util/path.h | 9 +
> tools/perf/util/perf-hooks.c | 1 +
> tools/perf/util/pmu.c | 2 +
> tools/perf/util/print_binary.c | 55 +++++
> tools/perf/util/print_binary.h | 28 +++
> tools/perf/util/probe-event.c | 5 +
> tools/perf/util/probe-event.h | 7 +-
> tools/perf/util/probe-file.c | 3 +
> tools/perf/util/probe-file.h | 6 +-
> tools/perf/util/probe-finder.c | 3 +
> tools/perf/util/probe-finder.h | 2 +-
> tools/perf/util/python-ext-sources | 1 +
> tools/perf/util/python.c | 1 +
> tools/perf/util/quote.c | 1 +
> tools/perf/util/record.c | 1 +
> tools/perf/util/sane_ctype.h | 51 +++++
> .../perf/util/scripting-engines/trace-event-perl.c | 1 +
> .../util/scripting-engines/trace-event-python.c | 2 +
> tools/perf/util/session.c | 2 +
> tools/perf/util/session.h | 1 +
> tools/perf/util/sort.c | 5 +
> tools/perf/util/sort.h | 4 +-
> tools/perf/util/srcline.c | 2 +
> tools/perf/util/srcline.h | 34 +++
> tools/perf/util/stat.c | 2 +
> tools/perf/util/strbuf.c | 1 +
> tools/perf/util/strfilter.c | 5 +-
> tools/perf/util/string.c | 18 +-
> tools/perf/util/string2.h | 42 ++++
> tools/perf/util/symbol-elf.c | 3 +-
> tools/perf/util/symbol-minimal.c | 1 +
> tools/perf/util/symbol.c | 3 +
> tools/perf/util/symbol.h | 2 +-
> tools/perf/util/term.c | 6 +-
> tools/perf/util/thread-stack.c | 1 +
> tools/perf/util/thread.c | 2 +
> tools/perf/util/thread_map.c | 2 +
> tools/perf/util/trace-event-parse.c | 3 +-
> tools/perf/util/unwind-libdw.c | 1 +
> tools/perf/util/unwind-libunwind-local.c | 2 +
> tools/perf/util/util.c | 64 +-----
> tools/perf/util/util.h | 249 +--------------------
> tools/perf/util/vdso.c | 2 +-
> 180 files changed, 659 insertions(+), 376 deletions(-)
> create mode 100644 tools/include/linux/bug.h
> create mode 100644 tools/perf/util/path.h
> create mode 100644 tools/perf/util/print_binary.c
> create mode 100644 tools/perf/util/print_binary.h
> create mode 100644 tools/perf/util/sane_ctype.h
> create mode 100644 tools/perf/util/srcline.h
> create mode 100644 tools/perf/util/string2.h
Pulled, thanks a lot Arnaldo!
> For this specific pull request the samples/bpf/ was disabled, as 'make headers_install'
> is failing with the following error, in this case in fedora:rawhide:
>
> INSTALL usr/include/uapi/ (0 file)
> /git/linux/scripts/Makefile.headersinst:62: *** Missing generated UAPI file
./arch/x86/include/generated/uapi/asm/unistd_32.h. Stop.
> make[1]: *** [/git/linux/Makefile:1151: headers_install] Error 2
> make[1]: Leaving directory '/tmp/build/linux'
> make: *** [Makefile:152: sub-make] Error 2
> make: Leaving directory '/git/linux'
Beyond this build fix, could we also do a header file synchronization round:
Warning: include/uapi/linux/stat.h differs from kernel
Warning: arch/x86/include/asm/cpufeatures.h differs from kernel
Warning: arch/x86/lib/memcpy_64.S differs from kernel
... so that Linus does not see these warnings when pulling these bits in the merge
window?
Thanks,
Ingo
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [GIT PULL 00/28] perf/core fixes and cleanups
2017-04-20 8:10 ` [GIT PULL 00/28] perf/core fixes and cleanups Ingo Molnar
@ 2017-04-20 11:24 ` Arnaldo Carvalho de Melo
2017-04-20 11:29 ` Ingo Molnar
0 siblings, 1 reply; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-20 11:24 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Adrian Hunter, David Ahern, Jean Pihet, Jiri Olsa,
Josh Poimboeuf, Namhyung Kim, Wang Nan, Arnaldo Carvalho de Melo
Em Thu, Apr 20, 2017 at 10:10:49AM +0200, Ingo Molnar escreveu:
> * Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> Pulled, thanks a lot Arnaldo!
>
> > For this specific pull request the samples/bpf/ was disabled, as 'make headers_install'
> > is failing with the following error, in this case in fedora:rawhide:
> >
> > INSTALL usr/include/uapi/ (0 file)
> > /git/linux/scripts/Makefile.headersinst:62: *** Missing generated UAPI file
> ./arch/x86/include/generated/uapi/asm/unistd_32.h. Stop.
> > make[1]: *** [/git/linux/Makefile:1151: headers_install] Error 2
> > make[1]: Leaving directory '/tmp/build/linux'
> > make: *** [Makefile:152: sub-make] Error 2
> > make: Leaving directory '/git/linux'
>
> Beyond this build fix,
I haven't checked this lately, will do, hopefully this was already taken
care of by someone dealing with the headers_install code.
> could we also do a header file synchronization round:
> Warning: include/uapi/linux/stat.h differs from kernel
> Warning: arch/x86/include/asm/cpufeatures.h differs from kernel
> Warning: arch/x86/lib/memcpy_64.S differs from kernel
>
> ... so that Linus does not see these warnings when pulling these bits in the merge
> window?
Sure, will do.
- Arnaldo
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [GIT PULL 00/28] perf/core fixes and cleanups
2017-04-20 11:24 ` Arnaldo Carvalho de Melo
@ 2017-04-20 11:29 ` Ingo Molnar
2017-04-20 17:10 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 35+ messages in thread
From: Ingo Molnar @ 2017-04-20 11:29 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: linux-kernel, Adrian Hunter, David Ahern, Jean Pihet, Jiri Olsa,
Josh Poimboeuf, Namhyung Kim, Wang Nan, Arnaldo Carvalho de Melo
* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> Em Thu, Apr 20, 2017 at 10:10:49AM +0200, Ingo Molnar escreveu:
> > * Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> > Pulled, thanks a lot Arnaldo!
> >
> > > For this specific pull request the samples/bpf/ was disabled, as 'make headers_install'
> > > is failing with the following error, in this case in fedora:rawhide:
> > >
> > > INSTALL usr/include/uapi/ (0 file)
> > > /git/linux/scripts/Makefile.headersinst:62: *** Missing generated UAPI file
> > ./arch/x86/include/generated/uapi/asm/unistd_32.h. Stop.
> > > make[1]: *** [/git/linux/Makefile:1151: headers_install] Error 2
> > > make[1]: Leaving directory '/tmp/build/linux'
> > > make: *** [Makefile:152: sub-make] Error 2
> > > make: Leaving directory '/git/linux'
> >
> > Beyond this build fix,
>
> I haven't checked this lately, will do, hopefully this was already taken
> care of by someone dealing with the headers_install code.
Ah, sorry, I thought it's a problem introduced by perf - if it's an existing
upstream bug then never mind!
Thanks,
Ingo
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [GIT PULL 00/28] perf/core fixes and cleanups
2017-04-20 11:29 ` Ingo Molnar
@ 2017-04-20 17:10 ` Arnaldo Carvalho de Melo
2017-04-20 18:29 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-20 17:10 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Adrian Hunter, David Ahern, Jean Pihet, Jiri Olsa,
Josh Poimboeuf, Namhyung Kim, Wang Nan, Arnaldo Carvalho de Melo
Em Thu, Apr 20, 2017 at 01:29:26PM +0200, Ingo Molnar escreveu:
>
> * Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
>
> > Em Thu, Apr 20, 2017 at 10:10:49AM +0200, Ingo Molnar escreveu:
> > > * Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> > > Pulled, thanks a lot Arnaldo!
> > >
> > > > For this specific pull request the samples/bpf/ was disabled, as 'make headers_install'
> > > > is failing with the following error, in this case in fedora:rawhide:
> > > >
> > > > INSTALL usr/include/uapi/ (0 file)
> > > > /git/linux/scripts/Makefile.headersinst:62: *** Missing generated UAPI file
> > > ./arch/x86/include/generated/uapi/asm/unistd_32.h. Stop.
> > > > make[1]: *** [/git/linux/Makefile:1151: headers_install] Error 2
> > > > make[1]: Leaving directory '/tmp/build/linux'
> > > > make: *** [Makefile:152: sub-make] Error 2
> > > > make: Leaving directory '/git/linux'
> > >
> > > Beyond this build fix,
> >
> > I haven't checked this lately, will do, hopefully this was already taken
> > care of by someone dealing with the headers_install code.
>
> Ah, sorry, I thought it's a problem introduced by perf - if it's an existing
> upstream bug then never mind!
Checking it now, this is what I disabled in the recent containers with
recent enough distros/tollchains to build this, like
debian:experimental:
+# make -C /git/linux O=/tmp/build/linux allmodconfig && \
+# make -C /git/linux O=/tmp/build/linux headers_install && \
+# make -C /git/linux O=/tmp/build/linux samples/bpf/o
[root@jouet bin]# dsh debian:experimental
$ bash
perfbuilder@91b0b6879760:/$ make -C /git/linux O=/tmp/build/linux allmodconfig
make: Entering directory '/git/linux'
make[1]: Entering directory '/tmp/build/linux'
HOSTCC scripts/basic/fixdep
GEN ./Makefile
HOSTCC scripts/kconfig/conf.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/zconf.lex.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
scripts/kconfig/conf --allmodconfig Kconfig
#
# configuration written to .config
#
make[1]: Leaving directory '/tmp/build/linux'
make: Leaving directory '/git/linux'
perfbuilder@91b0b6879760:/$ make -C /git/linux O=/tmp/build/linux headers_install
make: Entering directory '/git/linux'
make[1]: Entering directory '/tmp/build/linux'
CHK include/generated/uapi/linux/version.h
UPD include/generated/uapi/linux/version.h
SYSTBL arch/x86/entry/syscalls/../../include/generated/asm/syscalls_32.h
SYSHDR arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_32.h
HOSTCC arch/x86/tools/relocs_32.o
HOSTCC arch/x86/tools/relocs_64.o
HOSTCC arch/x86/tools/relocs_common.o
HOSTLD arch/x86/tools/relocs
HOSTCC scripts/unifdef
INSTALL usr/include/asm-generic/ (35 files)
INSTALL usr/include/drm/ (22 files)
INSTALL usr/include/linux/android/ (1 file)
INSTALL usr/include/linux/byteorder/ (2 files)
INSTALL usr/include/linux/caif/ (2 files)
INSTALL usr/include/linux/can/ (5 files)
INSTALL usr/include/linux/dvb/ (8 files)
INSTALL usr/include/linux/hdlc/ (1 file)
INSTALL usr/include/linux/hsi/ (2 files)
INSTALL usr/include/linux/iio/ (2 files)
INSTALL usr/include/linux/isdn/ (1 file)
INSTALL usr/include/linux/mmc/ (1 file)
INSTALL usr/include/linux/netfilter/ipset/ (4 files)
INSTALL usr/include/linux/netfilter/ (87 files)
INSTALL usr/include/linux/netfilter_arp/ (2 files)
INSTALL usr/include/linux/netfilter_bridge/ (17 files)
INSTALL usr/include/linux/netfilter_ipv4/ (9 files)
INSTALL usr/include/linux/netfilter_ipv6/ (12 files)
INSTALL usr/include/linux/nfsd/ (5 files)
INSTALL usr/include/linux/raid/ (2 files)
INSTALL usr/include/linux/spi/ (1 file)
INSTALL usr/include/linux/sunrpc/ (1 file)
INSTALL usr/include/linux/tc_act/ (15 files)
INSTALL usr/include/linux/tc_ematch/ (4 files)
INSTALL usr/include/linux/usb/ (11 files)
INSTALL usr/include/linux/wimax/ (1 file)
INSTALL usr/include/linux/ (452 files)
INSTALL usr/include/misc/ (1 file)
INSTALL usr/include/mtd/ (5 files)
INSTALL usr/include/rdma/hfi/ (2 files)
INSTALL usr/include/rdma/ (18 files)
INSTALL usr/include/scsi/fc/ (4 files)
INSTALL usr/include/scsi/ (4 files)
INSTALL usr/include/sound/ (15 files)
INSTALL usr/include/video/ (3 files)
INSTALL usr/include/xen/ (4 files)
INSTALL usr/include/uapi/ (0 file)
/git/linux/scripts/Makefile.headersinst:62: *** Missing generated UAPI file ./arch/x86/include/generated/uapi/asm/unistd_64.h. Stop.
/git/linux/Makefile:1149: recipe for target 'headers_install' failed
make[1]: *** [headers_install] Error 2
make[1]: Leaving directory '/tmp/build/linux'
Makefile:152: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2
make: Leaving directory '/git/linux'
perfbuilder@91b0b6879760:/$
Now if I try outside the container, on a fedora:25 system, same result:
[acme@jouet linux]$ rm -rf /tmp/build/linux
[acme@jouet linux]$ mkdir /tmp/build/linux
[acme@jouet linux]$ make O=/tmp/build/linux allmodconfig
make[1]: Entering directory '/tmp/build/linux'
HOSTCC scripts/basic/fixdep
GEN ./Makefile
HOSTCC scripts/kconfig/conf.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/zconf.lex.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
scripts/kconfig/conf --allmodconfig Kconfig
#
# configuration written to .config
#
make[1]: Leaving directory '/tmp/build/linux'
[acme@jouet linux]$ make O=/tmp/build/linux headers_install
make[1]: Entering directory '/tmp/build/linux'
CHK include/generated/uapi/linux/version.h
UPD include/generated/uapi/linux/version.h
SYSTBL arch/x86/entry/syscalls/../../include/generated/asm/syscalls_32.h
SYSHDR arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_32.h
HOSTCC arch/x86/tools/relocs_32.o
HOSTCC arch/x86/tools/relocs_64.o
HOSTCC arch/x86/tools/relocs_common.o
HOSTLD arch/x86/tools/relocs
HOSTCC scripts/unifdef
INSTALL usr/include/asm-generic/ (35 files)
INSTALL usr/include/drm/ (22 files)
INSTALL usr/include/linux/android/ (1 file)
INSTALL usr/include/linux/byteorder/ (2 files)
INSTALL usr/include/linux/caif/ (2 files)
INSTALL usr/include/linux/can/ (5 files)
INSTALL usr/include/linux/dvb/ (8 files)
INSTALL usr/include/linux/hdlc/ (1 file)
INSTALL usr/include/linux/hsi/ (2 files)
INSTALL usr/include/linux/iio/ (2 files)
INSTALL usr/include/linux/isdn/ (1 file)
INSTALL usr/include/linux/mmc/ (1 file)
INSTALL usr/include/linux/netfilter/ipset/ (4 files)
INSTALL usr/include/linux/netfilter/ (87 files)
INSTALL usr/include/linux/netfilter_arp/ (2 files)
INSTALL usr/include/linux/netfilter_bridge/ (17 files)
INSTALL usr/include/linux/netfilter_ipv4/ (9 files)
INSTALL usr/include/linux/netfilter_ipv6/ (12 files)
INSTALL usr/include/linux/nfsd/ (5 files)
INSTALL usr/include/linux/raid/ (2 files)
INSTALL usr/include/linux/spi/ (1 file)
INSTALL usr/include/linux/sunrpc/ (1 file)
INSTALL usr/include/linux/tc_act/ (15 files)
INSTALL usr/include/linux/tc_ematch/ (4 files)
INSTALL usr/include/linux/usb/ (11 files)
INSTALL usr/include/linux/wimax/ (1 file)
INSTALL usr/include/linux/ (452 files)
INSTALL usr/include/misc/ (1 file)
INSTALL usr/include/mtd/ (5 files)
INSTALL usr/include/rdma/hfi/ (2 files)
INSTALL usr/include/rdma/ (18 files)
INSTALL usr/include/scsi/fc/ (4 files)
INSTALL usr/include/scsi/ (4 files)
INSTALL usr/include/sound/ (15 files)
INSTALL usr/include/video/ (3 files)
INSTALL usr/include/xen/ (4 files)
INSTALL usr/include/uapi/ (0 file)
/home/acme/git/linux/scripts/Makefile.headersinst:62: *** Missing generated UAPI file ./arch/x86/include/generated/uapi/asm/unistd_64.h. Stop.
/home/acme/git/linux/Makefile:1149: recipe for target 'headers_install' failed
make[1]: *** [headers_install] Error 2
make[1]: Leaving directory '/tmp/build/linux'
Makefile:152: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2
[acme@jouet linux]$
Trying to investigate this further now... Perhaps I'm missing something
:-\
- Arnaldo
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [GIT PULL 00/28] perf/core fixes and cleanups
2017-04-20 17:10 ` Arnaldo Carvalho de Melo
@ 2017-04-20 18:29 ` Arnaldo Carvalho de Melo
2017-04-20 18:51 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-20 18:29 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Adrian Hunter, David Ahern, Jean Pihet, Jiri Olsa,
Josh Poimboeuf, Namhyung Kim, Wang Nan, Arnaldo Carvalho de Melo
Em Thu, Apr 20, 2017 at 02:10:58PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Thu, Apr 20, 2017 at 01:29:26PM +0200, Ingo Molnar escreveu:
> > * Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> > > Em Thu, Apr 20, 2017 at 10:10:49AM +0200, Ingo Molnar escreveu:
> > > > * Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> > > > Pulled, thanks a lot Arnaldo!
> > > >
> > > > > For this specific pull request the samples/bpf/ was disabled, as 'make headers_install'
> > > > > is failing with the following error, in this case in fedora:rawhide:
> > > > >
> > > > > INSTALL usr/include/uapi/ (0 file)
> > > > > /git/linux/scripts/Makefile.headersinst:62: *** Missing generated UAPI file
> > > > ./arch/x86/include/generated/uapi/asm/unistd_32.h. Stop.
> > > > > make[1]: *** [/git/linux/Makefile:1151: headers_install] Error 2
> > > > > make[1]: Leaving directory '/tmp/build/linux'
> > > > > make: *** [Makefile:152: sub-make] Error 2
> > > > > make: Leaving directory '/git/linux'
> > > >
> > > > Beyond this build fix,
> > >
> > > I haven't checked this lately, will do, hopefully this was already taken
> > > care of by someone dealing with the headers_install code.
> >
> > Ah, sorry, I thought it's a problem introduced by perf - if it's an existing
> > upstream bug then never mind!
>
>
> Now if I try outside the container, on a fedora:25 system, same result:
>
> [acme@jouet linux]$ rm -rf /tmp/build/linux
> [acme@jouet linux]$ mkdir /tmp/build/linux
> [acme@jouet linux]$ make O=/tmp/build/linux allmodconfig
> make[1]: Entering directory '/tmp/build/linux'
> HOSTCC scripts/basic/fixdep
> GEN ./Makefile
> HOSTCC scripts/kconfig/conf.o
> SHIPPED scripts/kconfig/zconf.tab.c
> SHIPPED scripts/kconfig/zconf.lex.c
> SHIPPED scripts/kconfig/zconf.hash.c
> HOSTCC scripts/kconfig/zconf.tab.o
> HOSTLD scripts/kconfig/conf
> scripts/kconfig/conf --allmodconfig Kconfig
> #
> # configuration written to .config
> #
> make[1]: Leaving directory '/tmp/build/linux'
> [acme@jouet linux]$ make O=/tmp/build/linux headers_install
> make[1]: Entering directory '/tmp/build/linux'
> INSTALL usr/include/sound/ (15 files)
> INSTALL usr/include/video/ (3 files)
> /home/acme/git/linux/scripts/Makefile.headersinst:62: *** Missing generated UAPI file ./arch/x86/include/generated/uapi/asm/unistd_64.h. Stop.
> /home/acme/git/linux/Makefile:1149: recipe for target 'headers_install' failed
> make[1]: *** [headers_install] Error 2
> make[1]: Leaving directory '/tmp/build/linux'
> Makefile:152: recipe for target 'sub-make' failed
> make: *** [sub-make] Error 2
> [acme@jouet linux]$
>
> Trying to investigate this further now... Perhaps I'm missing something
> :-\
So, it seems that headers_install needs to have as a dependency the
target that generates those headers (/generated/), as it works if I
actually start building the kernel and then do the headers_install
step.
that or allmodconfig
is broken, probably the former, checking...
- Arnaldo
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [GIT PULL 00/28] perf/core fixes and cleanups
2017-04-20 18:29 ` Arnaldo Carvalho de Melo
@ 2017-04-20 18:51 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-20 18:51 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Adrian Hunter, David Ahern, Jean Pihet, Jiri Olsa,
Josh Poimboeuf, Namhyung Kim, Wang Nan, Arnaldo Carvalho de Melo
Em Thu, Apr 20, 2017 at 03:29:54PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Thu, Apr 20, 2017 at 02:10:58PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Thu, Apr 20, 2017 at 01:29:26PM +0200, Ingo Molnar escreveu:
> > > * Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> > > > Em Thu, Apr 20, 2017 at 10:10:49AM +0200, Ingo Molnar escreveu:
> > > > > * Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> > > > > Pulled, thanks a lot Arnaldo!
> > > > >
> > > > > > For this specific pull request the samples/bpf/ was disabled, as 'make headers_install'
> > > > > > is failing with the following error, in this case in fedora:rawhide:
> > > > > >
> > > > > > INSTALL usr/include/uapi/ (0 file)
> > > > > > /git/linux/scripts/Makefile.headersinst:62: *** Missing generated UAPI file
> > > > > ./arch/x86/include/generated/uapi/asm/unistd_32.h. Stop.
> > > > > > make[1]: *** [/git/linux/Makefile:1151: headers_install] Error 2
> > > > > > make[1]: Leaving directory '/tmp/build/linux'
> > > > > > make: *** [Makefile:152: sub-make] Error 2
> > > > > > make: Leaving directory '/git/linux'
> > > > >
> > > > > Beyond this build fix,
> > > >
> > > > I haven't checked this lately, will do, hopefully this was already taken
> > > > care of by someone dealing with the headers_install code.
> > >
> > > Ah, sorry, I thought it's a problem introduced by perf - if it's an existing
> > > upstream bug then never mind!
> >
> >
> > Now if I try outside the container, on a fedora:25 system, same result:
> >
> > [acme@jouet linux]$ rm -rf /tmp/build/linux
> > [acme@jouet linux]$ mkdir /tmp/build/linux
> > [acme@jouet linux]$ make O=/tmp/build/linux allmodconfig
<SNIP>
> > /home/acme/git/linux/scripts/Makefile.headersinst:62: *** Missing generated UAPI file ./arch/x86/include/generated/uapi/asm/unistd_64.h. Stop.
> > /home/acme/git/linux/Makefile:1149: recipe for target 'headers_install' failed
> > make[1]: *** [headers_install] Error 2
> > make[1]: Leaving directory '/tmp/build/linux'
> > Makefile:152: recipe for target 'sub-make' failed
> > make: *** [sub-make] Error 2
> > [acme@jouet linux]$
> >
> > Trying to investigate this further now... Perhaps I'm missing something
> > :-\
>
> So, it seems that headers_install needs to have as a dependency the
> target that generates those headers (/generated/), as it works if I
> actually start building the kernel and then do the headers_install
> step.
> that or allmodconfig is broken, probably the former, checking...
Well, I tried using 'make defconfig' instead of 'make allmodconfig' and
things are back working...
Now debian:experimental is again building all the tests.
Will use that and reenable building samples/bpf/ in all the recent
enough distro containers.
- Arnaldo
^ permalink raw reply [flat|nested] 35+ messages in thread