diff options
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r-- | tools/perf/builtin-record.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index a5698add2fcb..c10553c3460f 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -169,10 +169,21 @@ static void mmap_read(struct mmap_data *md) | |||
169 | } | 169 | } |
170 | 170 | ||
171 | static volatile int done = 0; | 171 | static volatile int done = 0; |
172 | static volatile int signr = -1; | ||
172 | 173 | ||
173 | static void sig_handler(int sig) | 174 | static void sig_handler(int sig) |
174 | { | 175 | { |
175 | done = 1; | 176 | done = 1; |
177 | signr = sig; | ||
178 | } | ||
179 | |||
180 | static void sig_atexit(void) | ||
181 | { | ||
182 | if (signr == -1) | ||
183 | return; | ||
184 | |||
185 | signal(signr, SIG_DFL); | ||
186 | kill(getpid(), signr); | ||
176 | } | 187 | } |
177 | 188 | ||
178 | static void pid_synthesize_comm_event(pid_t pid, int full) | 189 | static void pid_synthesize_comm_event(pid_t pid, int full) |
@@ -459,6 +470,7 @@ static int __cmd_record(int argc, const char **argv) | |||
459 | } else for (i = 0; i < nr_cpus; i++) | 470 | } else for (i = 0; i < nr_cpus; i++) |
460 | open_counters(i, target_pid); | 471 | open_counters(i, target_pid); |
461 | 472 | ||
473 | atexit(sig_atexit); | ||
462 | signal(SIGCHLD, sig_handler); | 474 | signal(SIGCHLD, sig_handler); |
463 | signal(SIGINT, sig_handler); | 475 | signal(SIGINT, sig_handler); |
464 | 476 | ||