diff options
| author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-12-01 14:52:00 -0300 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-12-04 16:42:09 -0300 |
| commit | 54373b5d53c1f6aa6164ee5bea4761abb16b351c (patch) | |
| tree | f17d35ff7c16fc370ccb299a530ae5fd0699c36a /tools/perf/util/env.c | |
| parent | 556bed5c6d4167f9ffb5c8648cdd3c8e39aefec7 (diff) | |
| download | linux-54373b5d53c1f6aa6164ee5bea4761abb16b351c.tar.gz linux-54373b5d53c1f6aa6164ee5bea4761abb16b351c.tar.bz2 linux-54373b5d53c1f6aa6164ee5bea4761abb16b351c.zip | |
perf env: Introduce perf_env__arch_strerrno()
That will cache the arch specific function translating error numbers to
strings.
Reviewed-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Laight <David.Laight@ACULAB.COM>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/lkml/20231201203046.486596-2-acme@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/env.c')
| -rw-r--r-- | tools/perf/util/env.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c index cbc18b22ace5..a632f33646bb 100644 --- a/tools/perf/util/env.c +++ b/tools/perf/util/env.c @@ -3,6 +3,7 @@ #include "debug.h" #include "env.h" #include "util/header.h" +#include "linux/compiler.h" #include <linux/ctype.h> #include <linux/zalloc.h> #include "cgroup.h" @@ -12,6 +13,7 @@ #include <string.h> #include "pmus.h" #include "strbuf.h" +#include "trace/beauty/beauty.h" struct perf_env perf_env; @@ -453,6 +455,16 @@ const char *perf_env__arch(struct perf_env *env) return normalize_arch(arch_name); } +const char *perf_env__arch_strerrno(struct perf_env *env __maybe_unused, int err __maybe_unused) +{ +#if defined(HAVE_SYSCALL_TABLE_SUPPORT) && defined(HAVE_LIBTRACEEVENT) + const char *arch_name = perf_env__arch(env); + return arch_syscalls__strerrno(arch_name, err); +#else + return "!(HAVE_SYSCALL_TABLE_SUPPORT && HAVE_LIBTRACEEVENT)"; +#endif +} + const char *perf_env__cpuid(struct perf_env *env) { int status; |
