[PATCH 01/11] perf trace: Add seccomp beautifier related defines for older systems

From: Arnaldo Carvalho de Melo
Date: Thu Apr 14 2016 - 08:33:54 EST


From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>

Were the detached tarball (make perf-tar-src-pkg) build was failing because
those definitions aren't available in the system headers.

On RHEL7, for instance:

builtin-trace.c: In function âsyscall_arg__scnprintf_seccomp_opâ:
builtin-trace.c:1069:7: error: âSECCOMP_SET_MODE_STRICTâ undeclared (first use in this function)
P_SECCOMP_SET_MODE_OP(STRICT);
^
builtin-trace.c:1069:7: note: each undeclared identifier is reported only once for each function it appears in
builtin-trace.c:1070:7: error: âSECCOMP_SET_MODE_FILTERâ undeclared (first use in this function)
P_SECCOMP_SET_MODE_OP(FILTER);
^
builtin-trace.c: In function âsyscall_arg__scnprintf_seccomp_flagsâ:
builtin-trace.c:1091:14: error: âSECCOMP_FILTER_FLAG_TSYNCâ undeclared (first use in this function)
P_FLAG(TSYNC);
^

Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
Cc: David Ahern <dsahern@xxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Milian Wolff <milian.wolff@xxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Wang Nan <wangnan0@xxxxxxxxxx>
Link: http://lkml.kernel.org/n/tip-4f8dzzwd7g6l5dzz693u7kul@xxxxxxxxxxxxxx
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/perf/builtin-trace.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index d49c131bb5de..246866c63e5e 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -1059,6 +1059,13 @@ static const char *tioctls[] = {
static DEFINE_STRARRAY_OFFSET(tioctls, 0x5401);
#endif /* defined(__i386__) || defined(__x86_64__) */

+#ifndef SECCOMP_SET_MODE_STRICT
+#define SECCOMP_SET_MODE_STRICT 0
+#endif
+#ifndef SECCOMP_SET_MODE_FILTER
+#define SECCOMP_SET_MODE_FILTER 1
+#endif
+
static size_t syscall_arg__scnprintf_seccomp_op(char *bf, size_t size, struct syscall_arg *arg)
{
int op = arg->val;
@@ -1077,6 +1084,10 @@ static size_t syscall_arg__scnprintf_seccomp_op(char *bf, size_t size, struct sy

#define SCA_SECCOMP_OP syscall_arg__scnprintf_seccomp_op

+#ifndef SECCOMP_FILTER_FLAG_TSYNC
+#define SECCOMP_FILTER_FLAG_TSYNC 1
+#endif
+
static size_t syscall_arg__scnprintf_seccomp_flags(char *bf, size_t size,
struct syscall_arg *arg)
{
--
2.5.5