summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordsmith <dsmith>2007-07-26 20:27:17 +0000
committerdsmith <dsmith>2007-07-26 20:27:17 +0000
commitfc52ef5baf3208370014471fc7608712e1e4cb18 (patch)
tree7a80665b8d49ca00bd416fba73b6e1adfff1bff4
parent39dd928d212737c6b5c7e42ed71a0c699c0faf11 (diff)
downloadsystemtap-steved-fc52ef5baf3208370014471fc7608712e1e4cb18.tar.gz
systemtap-steved-fc52ef5baf3208370014471fc7608712e1e4cb18.tar.xz
systemtap-steved-fc52ef5baf3208370014471fc7608712e1e4cb18.zip
2007-07-26 David Smith <dsmith@redhat.com>
PR 4295 * main.cxx (main): If '-m MODNAME' is used, the generated module is saved in the current directory. * stap.1.in: Updated '-m' description.
-rw-r--r--ChangeLog7
-rw-r--r--main.cxx21
-rw-r--r--stap.1.in3
3 files changed, 28 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 1abea849..e0020586 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-07-26 David Smith <dsmith@redhat.com>
+
+ PR 4295
+ * main.cxx (main): If '-m MODNAME' is used, the generated module
+ is saved in the current directory.
+ * stap.1.in: Updated '-m' description.
+
2007-07-11 William Cohen <wcohen@redhat.com>
* systemtap.spec.in: Make sqlite support selectable.
diff --git a/main.cxx b/main.cxx
index d54713a6..0639f689 100644
--- a/main.cxx
+++ b/main.cxx
@@ -191,6 +191,7 @@ main (int argc, char * const argv [])
string script_file; // FILE
bool have_script = false;
bool release_changed = false;
+ bool save_module = false;
// Initialize defaults
systemtap_session s;
@@ -330,6 +331,7 @@ main (int argc, char * const argv [])
case 'm':
s.module_name = string (optarg);
+ save_module = true;
{
string::size_type len = s.module_name.length();
@@ -769,10 +771,25 @@ main (int argc, char * const argv [])
cerr << "Pass 4: compilation failed. "
<< "Try again with more '-v' (verbose) options."
<< endl;
- else if (s.use_cache)
+ else
{
// Update cache.
- add_to_cache(s);
+ if (s.use_cache)
+ add_to_cache(s);
+
+ // Copy module to the current directory.
+ if (save_module)
+ {
+ string module_src_path = s.tmpdir + "/" + s.module_name + ".ko";
+ string module_dest_path = s.module_name + ".ko";
+
+ if (s.verbose > 1)
+ clog << "Copying " << module_src_path << " to "
+ << module_dest_path << endl;
+ if (copy_file(module_src_path.c_str(), module_dest_path.c_str()) != 0)
+ cerr << "Copy failed (\"" << module_src_path << "\" to \""
+ << module_dest_path << "\"): " << strerror(errno) << endl;
+ }
}
if (rc || s.last_pass == 4) goto cleanup;
diff --git a/stap.1.in b/stap.1.in
index 0c968620..a35a6ca7 100644
--- a/stap.1.in
+++ b/stap.1.in
@@ -137,7 +137,8 @@ Build for given kernel release instead of currently running one.
.TP
.BI \-m " MODULE"
Use the given name for the generated kernel object module, instead
-of a unique randomized name.
+of a unique randomized name. The generated kernel object module is
+copied to the current directory.
.TP
.BI \-o " FILE"
Send standard output to named file. In bulk mode, percpu files will