lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed,  8 Mar 2017 00:08:39 +0900
From:   Namhyung Kim <namhyung@...nel.org>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     Ingo Molnar <mingo@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Jiri Olsa <jolsa@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>, kernel-team@....com
Subject: [PATCH 11/23] perf kallsyms: Add -q/--quiet option

The -q/--quiet option is to suppress any message.  Sometimes users just
want to run the command and it can be used for that case.

Before:

  $ perf kallsyms vfs_open no_symbol
  vfs_open: [kernel] [kernel.kallsyms] 0xffffffff81207b90-0xffffffff81207c00 (0xffffffff81207b90-0xffffffff81207c00)
  no_symbol: not found

After:

  $ perf kallsyms -q vfs_open no_symbol
  vfs_open: [kernel] [kernel.kallsyms] 0xffffffff81207b90-0xffffffff81207c00 (0xffffffff81207b90-0xffffffff81207c00)

Suggested-by: Arnaldo Carvalho de Melo <acme@...hat.com>
Signed-off-by: Namhyung Kim <namhyung@...nel.org>
---
 tools/perf/Documentation/perf-kallsyms.txt | 4 ++++
 tools/perf/builtin-kallsyms.c              | 7 ++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/tools/perf/Documentation/perf-kallsyms.txt b/tools/perf/Documentation/perf-kallsyms.txt
index 954ea9e21236..c3c2aebb4660 100644
--- a/tools/perf/Documentation/perf-kallsyms.txt
+++ b/tools/perf/Documentation/perf-kallsyms.txt
@@ -22,3 +22,7 @@ OPTIONS
 -v::
 --verbose=::
 	Increase verbosity level, showing details about symbol table loading, etc.
+
+-q::
+--quiet::
+	Do not show any message.
diff --git a/tools/perf/builtin-kallsyms.c b/tools/perf/builtin-kallsyms.c
index 224bfc454b4a..45a8e50a7f21 100644
--- a/tools/perf/builtin-kallsyms.c
+++ b/tools/perf/builtin-kallsyms.c
@@ -29,7 +29,8 @@ static int __cmd_kallsyms(int argc, const char **argv)
 		struct symbol *symbol = machine__find_kernel_function_by_name(machine, argv[i], &map);
 
 		if (symbol == NULL) {
-			printf("%s: not found\n", argv[i]);
+			if (!quiet)
+				printf("%s: not found\n", argv[i]);
 			continue;
 		}
 
@@ -47,6 +48,7 @@ int cmd_kallsyms(int argc, const char **argv, const char *prefix __maybe_unused)
 {
 	const struct option options[] = {
 	OPT_INCR('v', "verbose", &verbose, "be more verbose (show counter open errors, etc)"),
+	OPT_BOOLEAN('q', "quiet", &quiet, "Do not show any message"),
 	OPT_END()
 	};
 	const char * const kallsyms_usage[] = {
@@ -58,6 +60,9 @@ int cmd_kallsyms(int argc, const char **argv, const char *prefix __maybe_unused)
 	if (argc < 1)
 		usage_with_options(kallsyms_usage, options);
 
+	if (quiet)
+		perf_quiet_option();
+
 	symbol_conf.sort_by_name = true;
 	symbol_conf.try_vmlinux_path = (symbol_conf.vmlinux_name == NULL);
 	if (symbol__init(NULL) < 0)
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ