perf trace: Add aliases for some syscalls
authorArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 27 Sep 2012 16:16:00 +0000 (13:16 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 27 Sep 2012 16:18:49 +0000 (13:18 -0300)
What we get from audit_syscall_to_name isn't what we find in the
syscalls: tracepoint events, so add the alias that allows the tool to
find prctl, fstat, fstatat and stat.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-3m9su7jhwnxvepnr3ne1du5k@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-trace.c

index 5fa1820cc969ae187dca75de4dbb21e9a076f3e1..8f113dab8bf1371bf508e138cb32993007a4cc68 100644 (file)
@@ -9,15 +9,20 @@
 
 static struct syscall_fmt {
        const char *name;
+       const char *alias;
        bool       errmsg;
        bool       timeout;
 } syscall_fmts[] = {
-       { .name     = "futex",    .errmsg = true, },
-       { .name     = "poll",     .errmsg = true, .timeout = true, },
-       { .name     = "ppoll",    .errmsg = true, .timeout = true, },
-       { .name     = "read",     .errmsg = true, },
-       { .name     = "recvfrom", .errmsg = true, },
-       { .name     = "select",   .errmsg = true, .timeout = true, },
+       { .name     = "arch_prctl", .errmsg = true, .alias = "prctl", },
+       { .name     = "fstat",      .errmsg = true, .alias = "newfstat", },
+       { .name     = "fstatat",    .errmsg = true, .alias = "newfstatat", },
+       { .name     = "futex",      .errmsg = true, },
+       { .name     = "poll",       .errmsg = true, .timeout = true, },
+       { .name     = "ppoll",      .errmsg = true, .timeout = true, },
+       { .name     = "read",       .errmsg = true, },
+       { .name     = "recvfrom",   .errmsg = true, },
+       { .name     = "select",     .errmsg = true, .timeout = true, },
+       { .name     = "stat",       .errmsg = true, .alias = "newstat", },
 };
 
 static int syscall_fmt__cmp(const void *name, const void *fmtp)
@@ -74,10 +79,15 @@ static int trace__read_syscall_info(struct trace *trace, int id)
        if (sc->name == NULL)
                return -1;
 
-       snprintf(tp_name, sizeof(tp_name), "sys_enter_%s", sc->name);
+       sc->fmt = syscall_fmt__find(sc->name);
 
+       snprintf(tp_name, sizeof(tp_name), "sys_enter_%s", sc->name);
        sc->tp_format = event_format__new("syscalls", tp_name);
-       sc->fmt = syscall_fmt__find(sc->name);
+
+       if (sc->tp_format == NULL && sc->fmt && sc->fmt->alias) {
+               snprintf(tp_name, sizeof(tp_name), "sys_enter_%s", sc->fmt->alias);
+               sc->tp_format = event_format__new("syscalls", tp_name);
+       }
 
        return sc->tp_format != NULL ? 0 : -1;
 }