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, 10 Dec 2015 00:18:45 -0800
From:	tip-bot for Josh Poimboeuf <tipbot@...or.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	jolsa@...hat.com, namhyung@...nel.org, acme@...hat.com,
	linux-kernel@...r.kernel.org, peterz@...radead.org, hpa@...or.com,
	tglx@...utronix.de, mingo@...nel.org, jpoimboe@...hat.com
Subject: [tip:perf/core] perf tools: Save cmdline arguments earlier

Commit-ID:  2bdb2c2729d2ba2f2f90b729d04254308096c5a0
Gitweb:     http://git.kernel.org/tip/2bdb2c2729d2ba2f2f90b729d04254308096c5a0
Author:     Josh Poimboeuf <jpoimboe@...hat.com>
AuthorDate: Mon, 7 Dec 2015 22:21:46 -0600
Committer:  Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Wed, 9 Dec 2015 13:42:03 -0300

perf tools: Save cmdline arguments earlier

perf_env__set_cmdline() only saves the arguments the first time it's
called.  It doesn't need to be called every time the options and
suboptions are parsed.  Instead it can just be called once.

This also has the advantage of making the option parsing code less
perf-specific so it can be moved out to a library.

Signed-off-by: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Link: http://lkml.kernel.org/r/19b76a5aa1b688bd635bd65d80bbc103a978d75e.1449548395.git.jpoimboe@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 tools/perf/perf.c               | 1 +
 tools/perf/util/env.c           | 9 ---------
 tools/perf/util/parse-options.c | 2 --
 3 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 4bee53c..59ea48c 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -384,6 +384,7 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
 		use_pager = 1;
 	commit_pager_choice();
 
+	perf_env__set_cmdline(&perf_env, argc, argv);
 	status = p->fn(argc, argv, prefix);
 	exit_browser(status);
 	perf_env__exit(&perf_env);
diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c
index 6af4f7c..7dd5939 100644
--- a/tools/perf/util/env.c
+++ b/tools/perf/util/env.c
@@ -25,15 +25,6 @@ int perf_env__set_cmdline(struct perf_env *env, int argc, const char *argv[])
 {
 	int i;
 
-	/*
-	 * If env->cmdline_argv has already been set, do not override it.  This allows
-	 * a command to set the cmdline, parse args and then call another
-	 * builtin function that implements a command -- e.g, cmd_kvm calling
-	 * cmd_record.
-	 */
-	if (env->cmdline_argv != NULL)
-		return 0;
-
 	/* do not include NULL termination */
 	env->cmdline_argv = calloc(argc, sizeof(char *));
 	if (env->cmdline_argv == NULL)
diff --git a/tools/perf/util/parse-options.c b/tools/perf/util/parse-options.c
index 9fca092..d09aff9 100644
--- a/tools/perf/util/parse-options.c
+++ b/tools/perf/util/parse-options.c
@@ -501,8 +501,6 @@ int parse_options_subcommand(int argc, const char **argv, const struct option *o
 {
 	struct parse_opt_ctx_t ctx;
 
-	perf_env__set_cmdline(&perf_env, argc, argv);
-
 	/* build usage string if it's not provided */
 	if (subcommands && !usagestr[0]) {
 		struct strbuf buf = STRBUF_INIT;
--
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