From: Jens Axboe Date: Mon, 4 Aug 2008 19:43:55 +0000 (+0200) Subject: Add SIGILL signal handler X-Git-Tag: fio-1.22-rc1~8 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=de79c9158eae1459970e0df6efc6a2b09d920f15 Add SIGILL signal handler If crc32c-intel is used and the opcode isn't supported by the CPU, we'll display a nice warning instead of just dying. Signed-off-by: Jens Axboe --- diff --git a/fio.c b/fio.c index cedbfb0d..ee752e12 100644 --- a/fio.c +++ b/fio.c @@ -125,6 +125,17 @@ static void sig_int(int sig) } } +static void sig_ill(int sig) +{ + if (!threads) + return; + + log_err("fio: illegal instruction. your cpu does not support " + "the sse4.2 instruction for crc32c\n"); + terminate_threads(TERMINATE_ALL); + exit(4); +} + static void set_sig_handlers(void) { struct sigaction act; @@ -138,6 +149,11 @@ static void set_sig_handlers(void) act.sa_handler = sig_int; act.sa_flags = SA_RESTART; sigaction(SIGINT, &act, NULL); + + memset(&act, 0, sizeof(act)); + act.sa_handler = sig_ill; + act.sa_flags = SA_RESTART; + sigaction(SIGILL, &act, NULL); } /*