summaryrefslogtreecommitdiffstats
path: root/runtime/staprun/mainloop.c
diff options
context:
space:
mode:
authorhunt <hunt>2007-04-02 17:03:57 +0000
committerhunt <hunt>2007-04-02 17:03:57 +0000
commitda5bc00621edbd01f290b8f779b075d3048c99a0 (patch)
treed982f578f7a116e98512a9cde171c808b3fe2d5d /runtime/staprun/mainloop.c
parent81406e9df9fe0b6f52fce796f070c4419bdf7986 (diff)
downloadsystemtap-steved-da5bc00621edbd01f290b8f779b075d3048c99a0.tar.gz
systemtap-steved-da5bc00621edbd01f290b8f779b075d3048c99a0.tar.xz
systemtap-steved-da5bc00621edbd01f290b8f779b075d3048c99a0.zip
2007-04-02 Martin Hunt <hunt@redhat.com>
* relay_old.c (close_oldrelayfs): If just detaching, call pthread_cancel. (open_relayfs_files): Just return 0 if relay_fd[cpu] not opened. (init_oldrelayfs): Scan percpu files to calculate ncpus. * mainloop.c (init_staprun): Call old transport init when necessary. (cleanup_and_exit): Ignore signals when cleaning up. * ctl.c (read_buffer_info): For old transport, need to read transport parameters.
Diffstat (limited to 'runtime/staprun/mainloop.c')
-rw-r--r--runtime/staprun/mainloop.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/runtime/staprun/mainloop.c b/runtime/staprun/mainloop.c
index d3b3d3b7..720f9ec5 100644
--- a/runtime/staprun/mainloop.c
+++ b/runtime/staprun/mainloop.c
@@ -143,9 +143,16 @@ int init_staprun(void)
if (attach_mod) {
if (init_ctl_channel() < 0)
return -1;
- if (init_relayfs() < 0) {
- close_ctl_channel();
- return -1;
+ if (use_old_transport) {
+ if (init_oldrelayfs() < 0) {
+ close_ctl_channel();
+ return -1;
+ }
+ } else {
+ if (init_relayfs() < 0) {
+ close_ctl_channel();
+ return -1;
+ }
}
return 0;
}
@@ -204,6 +211,11 @@ void cleanup_and_exit (int closed)
pid_t err;
static int exiting = 0;
+ signal(SIGINT, SIG_IGN);
+ signal(SIGTERM, SIG_IGN);
+ signal(SIGHUP, SIG_IGN);
+ signal(SIGQUIT, SIG_IGN);
+
if (exiting)
return;
exiting = 1;
@@ -217,7 +229,7 @@ void cleanup_and_exit (int closed)
while(wait(NULL) > 0) ;
if (use_old_transport)
- close_oldrelayfs();
+ close_oldrelayfs(closed == 2);
else
close_relayfs();
@@ -228,8 +240,7 @@ void cleanup_and_exit (int closed)
dbug("removing module\n");
snprintf(tmpbuf, sizeof(tmpbuf), "/sbin/rmmod -w %s", modname);
if (system(tmpbuf)) {
- fprintf(stderr, "ERROR: couldn't rmmod probe module %s. No output will be written.\n",
- modname);
+ fprintf(stderr, "ERROR: couldn't rmmod probe module %s.\n", modname);
exit(1);
}
} else if (closed == 2) {