From 5f8f9726e7466419db8b8e9c2205430ad1d33aad Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 18 Nov 2008 19:10:21 +0100 Subject: [PATCH] Handle ctrl-c properly with threads A stupid bug, the main process should just ignore its own SIGQUIT. Signed-off-by: Jens Axboe --- fio.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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) -- 2.25.1