summaryrefslogtreecommitdiffstats
path: root/runtime/staprun/staprun.c
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2009-10-13 17:33:29 -0400
committerFrank Ch. Eigler <fche@elastic.org>2009-10-13 17:33:29 -0400
commitc4ca2da6ca875c0142a4e7ffd95e0aa0c573590b (patch)
tree5af1c8dec7cb959c003f8fad83908013d7ac4390 /runtime/staprun/staprun.c
parent784a7d570306d7601a7338c95226a49dec156398 (diff)
downloadsystemtap-steved-c4ca2da6ca875c0142a4e7ffd95e0aa0c573590b.tar.gz
systemtap-steved-c4ca2da6ca875c0142a4e7ffd95e0aa0c573590b.tar.xz
systemtap-steved-c4ca2da6ca875c0142a4e7ffd95e0aa0c573590b.zip
runtime shutdown errors: simplify, improve error specificity
* transport/control.c (*_cmd): Return -Ecodes rather than "-1" from file_operations callbacks. * staprun/ctl.c (init_ctl_channel): Return distinct error codes. * staprun/staprun.c (remove_module): Skip connection attempt to .ctl file; just do delete_module() with O_NONBLOCK.
Diffstat (limited to 'runtime/staprun/staprun.c')
-rw-r--r--runtime/staprun/staprun.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/runtime/staprun/staprun.c b/runtime/staprun/staprun.c
index 7b4aba1c..c5651d9a 100644
--- a/runtime/staprun/staprun.c
+++ b/runtime/staprun/staprun.c
@@ -181,27 +181,25 @@ static int remove_module(const char *name, int verb)
int ret;
dbug(2, "%s\n", name);
+ (void) verb; /* XXX: ignore */
+
if (strcmp(name, "*") == 0) {
remove_all_modules();
return 0;
}
- /* Call init_ctl_channel() which actually attempts an open()
- * of the control channel. This is better than using access() because
- * an open on an already open channel will fail, preventing us from attempting
- * to remove an in-use module.
- */
- if (init_ctl_channel(name, 0) < 0) {
- if (verb)
- err("Error accessing systemtap module %s: %s\n", name, strerror(errno));
- return 1;
- }
- close_ctl_channel();
+ /* We could call init_ctl_channel / close_ctl_channel here, as a heuristic
+ to determine whether the module is being used by some other stapio process.
+ However, delete_module() does basically the same thing. */
dbug(2, "removing module %s\n", name);
STAP_PROBE1(staprun, remove__module, name);
- ret = delete_module (name, 0);
+ ret = delete_module (name, O_NONBLOCK);
if (ret != 0) {
+ /* XXX: maybe we should just accept this, with a
+ diagnostic, but without an error. Might it be
+ possible for the same module to be started up just
+ as we're shutting down? */
err("Error removing module '%s': %s.\n", name, strerror(errno));
return 1;
}