From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933583AbeAXL02 (ORCPT ); Wed, 24 Jan 2018 06:26:28 -0500 Received: from terminus.zytor.com ([65.50.211.136]:46011 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933085AbeAXL0Z (ORCPT ); Wed, 24 Jan 2018 06:26:25 -0500 Date: Wed, 24 Jan 2018 03:25:15 -0800 From: tip-bot for Hendrik Brueckner Message-ID: Cc: tglx@linutronix.de, tmricht@linux.vnet.ibm.com, hpa@zytor.com, jolsa@redhat.com, mpetlan@redhat.com, acme@redhat.com, linux-kernel@vger.kernel.org, mingo@kernel.org, brueckner@linux.vnet.ibm.com Reply-To: mingo@kernel.org, brueckner@linux.vnet.ibm.com, tglx@linutronix.de, tmricht@linux.vnet.ibm.com, hpa@zytor.com, jolsa@redhat.com, linux-kernel@vger.kernel.org, acme@redhat.com, mpetlan@redhat.com To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf trace: Obtain errno strings by using arch_syscalls__strerrno() Git-Commit-ID: 092bd3cd7169085b09e4a5307de95e461d0581d7 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 092bd3cd7169085b09e4a5307de95e461d0581d7 Gitweb: https://git.kernel.org/tip/092bd3cd7169085b09e4a5307de95e461d0581d7 Author: Hendrik Brueckner AuthorDate: Fri, 19 Jan 2018 09:56:16 +0100 Committer: Arnaldo Carvalho de Melo CommitDate: Tue, 23 Jan 2018 09:51:38 -0300 perf trace: Obtain errno strings by using arch_syscalls__strerrno() Replace the errno_to_name() from the audit-libs with the newly introduced arch_syscalls__strerrno() function. With this change: 1. With replacing errno_to_name() from audit-libs, perf trace does no longer require audit-lib interfaces. 2. In addition to 1, the audit-libs dependency can be removed for architectures that support syscall tables in perf. This is achieved in a follow-up commit. 3. With the architecture specific errno number/name mapping, perf trace reports can work across architectures. Signed-off-by: Hendrik Brueckner Reviewed-by: Thomas Richter Tested-by: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Michael Petlan Cc: linux-s390@vger.kernel.org LPU-Reference: 1516352177-11106-5-git-send-email-brueckner@linux.vnet.ibm.com Link: https://lkml.kernel.org/n/tip-xjvoqzhwmu4wn4kl9ng11rvs@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-trace.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 531d43b..7dece5e 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -21,6 +21,7 @@ #include "builtin.h" #include "util/color.h" #include "util/debug.h" +#include "util/env.h" #include "util/event.h" #include "util/evlist.h" #include @@ -45,14 +46,12 @@ #include #include -#include /* FIXME: Still needed for audit_errno_to_name */ #include #include #include #include #include #include -#include #include #include #include @@ -545,6 +544,7 @@ static size_t syscall_arg__scnprintf_getrandom_flags(char *bf, size_t size, { .scnprintf = SCA_STRARRAY, \ .parm = &strarray__##array, } +#include "trace/beauty/arch_errno_names.c" #include "trace/beauty/eventfd.c" #include "trace/beauty/flock.c" #include "trace/beauty/futex_op.c" @@ -1660,6 +1660,14 @@ static int trace__fprintf_callchain(struct trace *trace, struct perf_sample *sam return sample__fprintf_callchain(sample, 38, print_opts, &callchain_cursor, trace->output); } +static const char *errno_to_name(struct perf_evsel *evsel, int err) +{ + struct perf_env *env = perf_evsel__env(evsel); + const char *arch_name = perf_env__arch(env); + + return arch_syscalls__strerrno(arch_name, err); +} + static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel, union perf_event *event __maybe_unused, struct perf_sample *sample) @@ -1730,7 +1738,7 @@ signed_print: errno_print: { char bf[STRERR_BUFSIZE]; const char *emsg = str_error_r(-ret, bf, sizeof(bf)), - *e = audit_errno_to_name(-ret); + *e = errno_to_name(evsel, -ret); fprintf(trace->output, ") = -1 %s %s", e, emsg); }