path: root/tools/perf/builtin-buildid-list.c
diff options
authorIan Munsie <>2010-04-13 18:37:33 +1000
committerIngo Molnar <>2010-04-14 11:26:44 +0200
commitc05556421742eb47f80301767653a4bcb19de9de (patch)
tree1e9c441a457acee41d2585e05692cc90c1d88be2 /tools/perf/builtin-buildid-list.c
parent53e5b5c215ce8372250e227f2c9acf9892de8434 (diff)
perf: Fix endianness argument compatibility with OPT_BOOLEAN() and introduce OPT_INCR()
Parsing an option from the command line with OPT_BOOLEAN on a bool data type would not work on a big-endian machine due to the manner in which the boolean was being cast into an int and incremented. For example, running 'perf probe --list' on a PowerPC machine would fail to properly set the list_events bool and would therefore print out the usage information and terminate. This patch makes OPT_BOOLEAN work as expected with a bool datatype. For cases where the original OPT_BOOLEAN was intentionally being used to increment an int each time it was passed in on the command line, this patch introduces OPT_INCR with the old behaviour of OPT_BOOLEAN (the verbose variable is currently the only such example of this). I have reviewed every use of OPT_BOOLEAN to verify that a true C99 bool was passed. Where integers were used, I verified that they were only being used for boolean logic and changed them to bools to ensure that they would not be mistakenly used as ints. The major exception was the verbose variable which now uses OPT_INCR instead of OPT_BOOLEAN. Signed-off-by: Ian Munsie <> Acked-by: David S. Miller <> Cc: <> # NOTE: wont apply to .3[34].x cleanly, please backport Cc: Git development list <> Cc: Ian Munsie <> Cc: Peter Zijlstra <> Cc: Paul Mackerras <> Cc: Arnaldo Carvalho de Melo <> Cc: KOSAKI Motohiro <> Cc: Hitoshi Mitake <> Cc: Rusty Russell <> Cc: Frederic Weisbecker <> Cc: Eric B Munson <> Cc: Cc: WANG Cong <> Cc: Thiago Farina <> Cc: Masami Hiramatsu <> Cc: Xiao Guangrong <> Cc: Jaswinder Singh Rajput <> Cc: Arjan van de Ven <> Cc: OGAWA Hirofumi <> Cc: Mike Galbraith <> Cc: Tom Zanussi <> Cc: Anton Blanchard <> Cc: John Kacur <> Cc: Li Zefan <> Cc: Steven Rostedt <> LKML-Reference: <> Signed-off-by: Ingo Molnar <>
Diffstat (limited to 'tools/perf/builtin-buildid-list.c')
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/builtin-buildid-list.c b/tools/perf/builtin-buildid-list.c
index d0675c02f81e..af2ad8b92f76 100644
--- a/tools/perf/builtin-buildid-list.c
+++ b/tools/perf/builtin-buildid-list.c
@@ -16,7 +16,7 @@
#include "util/symbol.h"
static char const *input_name = "";
-static int force;
+static bool force;
static bool with_hits;
static const char * const buildid_list_usage[] = {
@@ -29,7 +29,7 @@ static const struct option options[] = {
OPT_STRING('i', "input", &input_name, "file",
"input file name"),
OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),
- OPT_BOOLEAN('v', "verbose", &verbose,
+ OPT_INCR('v', "verbose", &verbose,
"be more verbose"),