summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorMartin Hunt <hunt@redhat.com>2008-05-05 15:02:39 -0400
committerMartin Hunt <hunt@redhat.com>2008-05-05 15:02:39 -0400
commit5aee7bca54fce01fe97c8ca168695bfd53c16fda (patch)
tree328cf73044348966bfbc5021f5986059c5c0c6ae /runtime
parent3c3355335d4e1f4a195999e784cd88118ca955d8 (diff)
downloadsystemtap-steved-5aee7bca54fce01fe97c8ca168695bfd53c16fda.tar.gz
systemtap-steved-5aee7bca54fce01fe97c8ca168695bfd53c16fda.tar.xz
systemtap-steved-5aee7bca54fce01fe97c8ca168695bfd53c16fda.zip
More signal cleanup.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/staprun/ChangeLog2
-rw-r--r--runtime/staprun/mainloop.c13
2 files changed, 6 insertions, 9 deletions
diff --git a/runtime/staprun/ChangeLog b/runtime/staprun/ChangeLog
index 14dac37d..969c299d 100644
--- a/runtime/staprun/ChangeLog
+++ b/runtime/staprun/ChangeLog
@@ -2,6 +2,8 @@
* mainloop.c (child_proc): Handle sig_chld
in the proper thread.
+ (signal_thread): Don't call send_request()
+ because it isn't thread-safe.
2008-05-05 Martin Hunt <hunt@redhat.com>
diff --git a/runtime/staprun/mainloop.c b/runtime/staprun/mainloop.c
index de4479dd..61963743 100644
--- a/runtime/staprun/mainloop.c
+++ b/runtime/staprun/mainloop.c
@@ -44,7 +44,7 @@ int send_request(int type, void *data, int len)
static void *signal_thread(void *arg)
{
sigset_t *s = (sigset_t *) arg;
- int signum;
+ int signum, rc, btype = STP_EXIT;
while (1) {
if (sigwait(s, &signum) < 0) {
@@ -52,16 +52,11 @@ static void *signal_thread(void *arg)
continue;
}
dbug(2, "sigproc %d (%s)\n", signum, strsignal(signum));
- if (signum == SIGCHLD) {
- pid_t pid = waitpid(-1, NULL, WNOHANG);
- if (pid == target_pid) {
- send_request(STP_EXIT, NULL, 0);
- break;
- }
- } else if (signum == SIGQUIT)
+ if (signum == SIGQUIT)
cleanup_and_exit(1);
else if (signum == SIGINT || signum == SIGHUP || signum == SIGTERM) {
- send_request(STP_EXIT, NULL, 0);
+ // send STP_EXIT
+ rc = write(control_channel, &btype, sizeof(btype));
break;
}
}