]> sourceware.org Git - systemtap.git/commitdiff
More signal cleanup.
authorMartin Hunt <hunt@redhat.com>
Mon, 5 May 2008 19:02:39 +0000 (15:02 -0400)
committerMartin Hunt <hunt@redhat.com>
Mon, 5 May 2008 19:02:39 +0000 (15:02 -0400)
runtime/staprun/ChangeLog
runtime/staprun/mainloop.c

index 14dac37dddb06367f51556ad94bf12817b3d8765..969c299df01ce542f09af898cf26f093882970d0 100644 (file)
@@ -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>
 
index de4479dd62217ce5fe18f64a0352d335bef07cff..6196374346f72374ab292558d7ddf372768a8e18 100644 (file)
@@ -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;
                }
        }
This page took 0.030516 seconds and 5 git commands to generate.