aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-stat.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-stat.c')
-rw-r--r--tools/perf/builtin-stat.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 80855090fd9..6404906924f 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -296,8 +296,20 @@ static int do_perf_stat(int argc, const char **argv)
296 return 0; 296 return 0;
297} 297}
298 298
299static volatile int signr = -1;
300
299static void skip_signal(int signo) 301static void skip_signal(int signo)
300{ 302{
303 signr = signo;
304}
305
306static void sig_atexit(void)
307{
308 if (signr == -1)
309 return;
310
311 signal(signr, SIG_DFL);
312 kill(getpid(), signr);
301} 313}
302 314
303static const char * const stat_usage[] = { 315static const char * const stat_usage[] = {
@@ -345,6 +357,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix)
345 * What we want is for Ctrl-C to work in the exec()-ed 357 * What we want is for Ctrl-C to work in the exec()-ed
346 * task, but being ignored by perf stat itself: 358 * task, but being ignored by perf stat itself:
347 */ 359 */
360 atexit(sig_atexit);
348 signal(SIGINT, skip_signal); 361 signal(SIGINT, skip_signal);
349 signal(SIGALRM, skip_signal); 362 signal(SIGALRM, skip_signal);
350 signal(SIGABRT, skip_signal); 363 signal(SIGABRT, skip_signal);