Handle ctrl-c properly with threads
authorJens Axboe <jens.axboe@oracle.com>
Tue, 18 Nov 2008 18:10:21 +0000 (19:10 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 18 Nov 2008 18:10:21 +0000 (19:10 +0100)
A stupid bug, the main process should just ignore its own SIGQUIT.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
fio.c

diff --git a/fio.c b/fio.c
index 08011c94b82480bf7a875b4a3d193733e8e954cd..2aa8b40156ce60abf93efd0a657286159f6a2a26 100644 (file)
--- 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)