perf util: Introduce architecture specific errno/name mapping
tip-bot for Hendrik Brueckner
merge botCommit-ID: 0337cf74ccf2a43437bff2e23b278e4f2dc4c6e2 Gitweb: https://git.kernel.org/tip/0337cf74ccf2a43437bff2e23b278e4f2dc4c6e2 Author: Hendrik Brueckner <[email protected]> AuthorDate: Fri, 19 Jan 2018 09:56:15 +0100 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 23 Jan 2018 09:51:37 -0300
perf util: Introduce architecture specific errno/name mapping
Introduce a script that generates a mapping of errno numbers to their names for each architecture that is supported by perf (i.e. has a subdirectory in tools/perf/arch/).
The errno mapping is generated as part of the trace beautifiers and can be used by including the trace/beauty/arch_errno_names.c file. Then, use arch_syscalls__strerrno() to look up an errno value to obtain the errno name (e.g. ENOENT) for a particular architecture.
Signed-off-by Hendrik Brueckner <[email protected]>
Reviewed-by Thomas Richter <[email protected]>
Suggested-by Arnaldo Carvalho de Melo <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Michael Petlan <[email protected]>
LPU-Reference: [email protected]
[ Make x86 be the first arch, most common, add newline to last line, fixing build on centos:5 ]
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/Makefile.perf | 13 +++- tools/perf/trace/beauty/arch_errno_names.c | 1 + tools/perf/trace/beauty/arch_errno_names.sh | 100 ++++++++++++++++++++++++++++ tools/perf/trace/beauty/beauty.h | 2 + 4 files changed, 114 insertions(+), 2 deletions(-)
tools/perf/Makefile.perf +11 -2
@@ -462,6 +462,13 @@ prctl_option_tbl := $(srctree)/tools/perf/trace/beauty/prctl_option.sh $(prctl_option_array): $(prctl_hdr_dir)/prctl.h $(prctl_option_tbl) $(Q)$(SHELL) '$(prctl_option_tbl)' $(prctl_hdr_dir) > $@ +arch_errno_name_array := $(beauty_outdir)/arch_errno_name_array.c +arch_errno_hdr_dir := $(srctree)/tools +arch_errno_tbl := $(srctree)/tools/perf/trace/beauty/arch_errno_names.sh + +$(arch_errno_name_array): $(arch_errno_tbl) + $(Q)$(SHELL) '$(arch_errno_tbl)' $(CC) $(arch_errno_hdr_dir) > $@ + all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS) $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBTRACEEVENT_DYNAMIC_LIST)
@@ -565,7 +572,8 @@ prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders $(drm_ioc $(vhost_virtio_ioctl_array) \ $(madvise_behavior_array) \ $(perf_ioctl_array) \ - $(prctl_option_array) + $(prctl_option_array) \ + $(arch_errno_name_array) $(OUTPUT)%.o: %.c prepare FORCE $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
@@ -847,7 +855,8 @@ clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clea $(OUTPUT)$(kcmp_type_array) \ $(OUTPUT)$(vhost_virtio_ioctl_array) \ $(OUTPUT)$(perf_ioctl_array) \ - $(OUTPUT)$(prctl_option_array) + $(OUTPUT)$(prctl_option_array) \ + $(OUTPUT)$(arch_errno_name_array) $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean #
tools/perf/trace/beauty/arch_errno_names.c new file +1 -0
@@ -0,0 +1 @@ +#include "trace/beauty/generated/arch_errno_name_array.c"
tools/perf/trace/beauty/arch_errno_names.sh new file +100 -0
100 lines not on this page · raw message
tools/perf/trace/beauty/beauty.h +2 -0
@@ -114,4 +114,6 @@ size_t open__scnprintf_flags(unsigned long flags, char *bf, size_t size);void syscall_arg__set_ret_scnprintf (struct syscall_arg *arg,size_t (*ret_scnprintf)(char *bf,size_t size,struct syscall_arg *arg)); +const char *arch_syscalls__strerrno (const char *arch,int err); +#endif /* _PERF_TRACE_BEAUTY_H */