Windows: handle SIGBREAK.
The only way to send a POSIX-style signal from another application on Windows
is to use GenerateConsoleCtrlEvent with either CTRL_C_EVENT or
CTRL_BREAK_EVENT. CTRL_BREAK_EVENT is the only one which gets through to
applications, so add a signal handler for it to allow fio to quit cleanly.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/client.c b/client.c
index 93c7103..bf09d7e 100644
--- a/client.c
+++ b/client.c
@@ -383,6 +383,14 @@
act.sa_flags = SA_RESTART;
sigaction(SIGTERM, &act, NULL);
+/* Windows uses SIGBREAK as a quit signal from other applications */
+#ifdef WIN32
+ memset(&act, 0, sizeof(act));
+ act.sa_handler = sig_int;
+ act.sa_flags = SA_RESTART;
+ sigaction(SIGBREAK, &act, NULL);
+#endif
+
memset(&act, 0, sizeof(act));
act.sa_handler = sig_show_status;
act.sa_flags = SA_RESTART;