summaryrefslogtreecommitdiffstats
path: root/runtime/staprun/mainloop.c
diff options
context:
space:
mode:
authorhunt <hunt>2007-08-21 16:28:43 +0000
committerhunt <hunt>2007-08-21 16:28:43 +0000
commitb574c7b95a7af0ab9d3dea67685b1f40354f6277 (patch)
treed7760c06aebb1a0dd3a16e5abd3b4ebad9571336 /runtime/staprun/mainloop.c
parent42b935893cd4ebc67aa1f9384844bf1108f97c37 (diff)
downloadsystemtap-steved-b574c7b95a7af0ab9d3dea67685b1f40354f6277.tar.gz
systemtap-steved-b574c7b95a7af0ab9d3dea67685b1f40354f6277.tar.xz
systemtap-steved-b574c7b95a7af0ab9d3dea67685b1f40354f6277.zip
2007-08-21 Martin Hunt <hunt@redhat.com>
* mainloop.c (start_cmd): Send SIGINT to target_cmd, not stapio.
Diffstat (limited to 'runtime/staprun/mainloop.c')
-rw-r--r--runtime/staprun/mainloop.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/runtime/staprun/mainloop.c b/runtime/staprun/mainloop.c
index 4acfb001..5072182e 100644
--- a/runtime/staprun/mainloop.c
+++ b/runtime/staprun/mainloop.c
@@ -27,8 +27,7 @@ static void sigproc(int signum)
return;
send_request(STP_EXIT, NULL, 0);
} else if (signum == SIGQUIT)
- cleanup_and_exit(2);
-
+ cleanup_and_exit(2);
else if (signum == SIGINT || signum == SIGHUP || signum == SIGTERM)
send_request(STP_EXIT, NULL, 0);
}
@@ -63,11 +62,19 @@ void start_cmd(void)
{
pid_t pid;
sigset_t usrset;
-
+ struct sigaction a;
+
sigemptyset(&usrset);
sigaddset(&usrset, SIGUSR1);
pthread_sigmask(SIG_BLOCK, &usrset, NULL);
+ /* if we are execing a target cmd, ignore ^C in stapio */
+ /* and let the target cmd get it. */
+ sigemptyset(&a.sa_mask);
+ a.sa_flags = 0;
+ a.sa_handler = SIG_IGN;
+ sigaction(SIGINT, &a, NULL);
+
dbug (1, "execing target_cmd %s\n", target_cmd);
if ((pid = fork()) < 0) {
_perr("fork");
@@ -75,6 +82,9 @@ void start_cmd(void)
} else if (pid == 0) {
int signum;
+ a.sa_handler = SIG_DFL;
+ sigaction(SIGINT, &a, NULL);
+
/* wait here until signaled */
sigwait(&usrset, &signum);
@@ -213,6 +223,7 @@ int init_stapio(void)
if (target_cmd)
start_cmd();
+
return 0;
}