summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2010-01-12 14:12:04 -0500
committerFrank Ch. Eigler <fche@elastic.org>2010-01-12 14:12:04 -0500
commit75c2a31ddbe337af46ec4dad8a4dbbbd790c47b7 (patch)
treeea2f996474238b7cd1841e10d67b92900570cb1f
parent1ff1a65d89bf66a877a1685e96d20a2a1379cece (diff)
downloadsystemtap-steved-75c2a31ddbe337af46ec4dad8a4dbbbd790c47b7.tar.gz
systemtap-steved-75c2a31ddbe337af46ec4dad8a4dbbbd790c47b7.tar.xz
systemtap-steved-75c2a31ddbe337af46ec4dad8a4dbbbd790c47b7.zip
tweak stap argument checking
* main.cxx (checkOptions): Inline into main(), abeam other option checks.
-rw-r--r--main.cxx60
1 files changed, 22 insertions, 38 deletions
diff --git a/main.cxx b/main.cxx
index 265fb363..1baced14 100644
--- a/main.cxx
+++ b/main.cxx
@@ -410,43 +410,6 @@ void parse_kernel_config (systemtap_session &s)
kcf.close();
}
-
-static void
-checkOptions (systemtap_session &s)
-{
- bool optionsConflict = false;
-
- if((s.cmd != "") && (s.target_pid))
- {
- cerr << "You can't specify -c and -x options together." <<endl;
- optionsConflict = true;
- }
-
- if (s.unprivileged)
- {
- if (s.guru_mode)
- {
- cerr << "You can't specify -g and --unprivileged together." << endl;
- optionsConflict = true;
- }
- }
-
- if (!s.kernel_symtab_path.empty())
- {
- if (s.consult_symtab)
- {
- cerr << "You can't specify --kelf and --kmap together." << endl;
- optionsConflict = true;
- }
- s.consult_symtab = true;
- if (s.kernel_symtab_path == PATH_TBD)
- s.kernel_symtab_path = string("/boot/System.map-") + s.kernel_release;
- }
-
- if (optionsConflict)
- usage (s, 1);
-}
-
/*
* Returns a string describing memory resource usage.
* Since it seems getrusage() doesn't maintain the mem related fields,
@@ -931,12 +894,33 @@ main (int argc, char * const argv [])
}
// Check for options conflicts.
+
if (client_options && s.unprivileged && ! client_options_disallowed.empty ())
{
cerr << "You can't specify " << client_options_disallowed << " when --unprivileged is specified." << endl;
usage (s, 1);
}
- checkOptions (s);
+ if ((s.cmd != "") && (s.target_pid))
+ {
+ cerr << "You can't specify -c and -x options together." << endl;
+ usage (s, 1);
+ }
+ if (s.unprivileged && s.guru_mode)
+ {
+ cerr << "You can't specify -g and --unprivileged together." << endl;
+ usage (s, 1);
+ }
+ if (!s.kernel_symtab_path.empty())
+ {
+ if (s.consult_symtab)
+ {
+ cerr << "You can't specify --kelf and --kmap together." << endl;
+ usage (s, 1);
+ }
+ s.consult_symtab = true;
+ if (s.kernel_symtab_path == PATH_TBD)
+ s.kernel_symtab_path = string("/boot/System.map-") + s.kernel_release;
+ }
// Warn in case the target kernel release doesn't match the running one.
if (s.last_pass > 4 &&