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:	Thu, 12 Dec 2013 15:39:30 -0500
From:	Dongsheng Yang <yangds.fnst@...fujitsu.com>
To:	acme@...hat.com, dsahern@...il.com
Cc:	linux-kernel@...r.kernel.org,
	Dongsheng Yang <yangds.fnst@...fujitsu.com>
Subject: [PATCH 6/6] perf tools: Enhancement for perf list for unexpected input.

Example:
	# perf list test

	List of pre-defined events (to be used in -e):
	# echo $?
	0

Verification:
	# perf list test

	Error: No event for test.
	Usage:
		perf list [hw|sw|cache|tracepoint|pmu|event_glob]
	# echo $?
	255

Signed-off-by: Dongsheng Yang <yangds.fnst@...fujitsu.com>
---
 tools/perf/builtin-list.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c
index 82d54b6..ba23f65 100644
--- a/tools/perf/builtin-list.c
+++ b/tools/perf/builtin-list.c
@@ -63,9 +63,11 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
 		else {
 			char *sep = strchr(argv[i], ':'), *s;
 			int sep_idx;
+			unsigned int count;
 
 			if (sep == NULL) {
-				print_events(argv[i], false);
+				if(!(count = print_events(argv[i], false)))
+					goto err_out;
 				continue;
 			}
 			sep_idx = sep - argv[i];
@@ -74,9 +76,16 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
 				return -1;
 
 			s[sep_idx] = '\0';
-			print_tracepoint_events(s, s + sep_idx + 1, false);
+			if (!(count = print_tracepoint_events(s, s + sep_idx + 1, false)))
+				goto err_out;
 			free(s);
 		}
 	}
+
 	return 0;
+
+err_out:
+	printf("\nError: No event for %s.\n", argv[i]);
+	printf("Usage:\n\t%s\n", list_usage[0]);
+	return -1;
 }
-- 
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ