summaryrefslogtreecommitdiffstats
path: root/runtime/staprun/ctl.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/ctl.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/ctl.c')
-rw-r--r--runtime/staprun/ctl.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/runtime/staprun/ctl.c b/runtime/staprun/ctl.c
index 4597bf72..335006ec 100644
--- a/runtime/staprun/ctl.c
+++ b/runtime/staprun/ctl.c
@@ -24,11 +24,11 @@ int init_ctl_channel(const char *name, int verb)
} else {
old_transport = 1;
if (sprintf_chk(buf, "/proc/systemtap/%s/.cmd", name))
- return -1;
+ return -2;
}
- dbug(2, "Opening %s\n", buf);
control_channel = open(buf, O_RDWR);
+ dbug(2, "Opened %s (%d)\n", buf, control_channel);
if (control_channel < 0) {
if (verb) {
if (attach_mod && errno == ENOENT)
@@ -36,10 +36,10 @@ int init_ctl_channel(const char *name, int verb)
else
perr("Couldn't open control channel '%s'", buf);
}
- return -1;
+ return -3;
}
if (set_clexec(control_channel) < 0)
- return -1;
+ return -4;
return old_transport;
}
@@ -47,6 +47,7 @@ int init_ctl_channel(const char *name, int verb)
void close_ctl_channel(void)
{
if (control_channel >= 0) {
+ dbug(2, "Closed ctl fd %d\n", control_channel);
close(control_channel);
control_channel = -1;
}