From: Jens Axboe Date: Tue, 18 Nov 2008 18:10:21 +0000 (+0100) Subject: Handle ctrl-c properly with threads X-Git-Tag: fio-1.23~1 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=5f8f9726e7466419db8b8e9c2205430ad1d33aad Handle ctrl-c properly with threads A stupid bug, the main process should just ignore its own SIGQUIT. Signed-off-by: Jens Axboe --- diff --git a/fio.c b/fio.c index 08011c94..2aa8b401 100644 --- a/fio.c +++ b/fio.c @@ -116,6 +116,13 @@ static void sig_alrm(int fio_unused sig) } } +/* + * Happens on thread runs with ctrl-c, ignore our own SIGQUIT + */ +static void sig_quit(int sig) +{ +} + static void sig_int(int sig) { if (threads) { @@ -154,6 +161,11 @@ static void set_sig_handlers(void) act.sa_handler = sig_ill; act.sa_flags = SA_RESTART; sigaction(SIGILL, &act, NULL); + + memset(&act, 0, sizeof(act)); + act.sa_handler = sig_quit; + act.sa_flags = SA_RESTART; + sigaction(SIGQUIT, &act, NULL); } static inline int should_check_rate(struct thread_data *td)