From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935500AbdGTI6y (ORCPT ); Thu, 20 Jul 2017 04:58:54 -0400 Received: from terminus.zytor.com ([65.50.211.136]:56991 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934945AbdGTI6v (ORCPT ); Thu, 20 Jul 2017 04:58:51 -0400 Date: Thu, 20 Jul 2017 01:56:40 -0700 From: tip-bot for Arnaldo Carvalho de Melo Message-ID: Cc: hpa@zytor.com, wangnan0@huawei.com, acme@redhat.com, adrian.hunter@intel.com, dsahern@gmail.com, linux-kernel@vger.kernel.org, mingo@kernel.org, namhyung@kernel.org, jolsa@kernel.org, tglx@linutronix.de Reply-To: namhyung@kernel.org, jolsa@kernel.org, tglx@linutronix.de, adrian.hunter@intel.com, hpa@zytor.com, acme@redhat.com, wangnan0@huawei.com, linux-kernel@vger.kernel.org, dsahern@gmail.com, mingo@kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf trace: Allow syscall arg formatters to request non suppression of zeros Git-Commit-ID: d47737d524174a81b80c487fe07de3ee2458ee32 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: d47737d524174a81b80c487fe07de3ee2458ee32 Gitweb: http://git.kernel.org/tip/d47737d524174a81b80c487fe07de3ee2458ee32 Author: Arnaldo Carvalho de Melo AuthorDate: Mon, 17 Jul 2017 15:59:03 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Tue, 18 Jul 2017 23:14:24 -0300 perf trace: Allow syscall arg formatters to request non suppression of zeros The 'perf trace' tool is suppressing args set to zero, with the exception of string tables (strarrays), which are kinda like enums, i.e. we have maps to go from numbers to strings. But the 'cmd' fcntl arg requires more specialized treatment, as its value will regulate if the next fcntl syscall arg, 'arg', should be ignored (not used) and also how to format the syscall return (fd, file flags, etc), so add a 'show_zero" bool to struct syscall_arg_fmt, to regulate this more explicitely. Will be used in a following patch with fcntl, here is just the mechanism. Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Link: http://lkml.kernel.org/n/tip-all738jctxets8ffyizp5lzo@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-trace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 32778a6..b842bd9 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -604,6 +604,7 @@ static size_t syscall_arg__scnprintf_getrandom_flags(char *bf, size_t size, struct syscall_arg_fmt { size_t (*scnprintf)(char *bf, size_t size, struct syscall_arg *arg); void *parm; + bool show_zero; }; static struct syscall_fmt { @@ -1428,7 +1429,8 @@ static size_t syscall__scnprintf_args(struct syscall *sc, char *bf, size_t size, */ if (val == 0 && !(sc->arg_fmt && - (sc->arg_fmt[arg.idx].scnprintf == SCA_STRARRAY || + (sc->arg_fmt[arg.idx].show_zero || + sc->arg_fmt[arg.idx].scnprintf == SCA_STRARRAY || sc->arg_fmt[arg.idx].scnprintf == SCA_STRARRAYS) && sc->arg_fmt[arg.idx].parm)) continue;