From d8a6c0a91bb06ff09a98630601c2fc76f86bd121 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 21 Jan 2017 14:07:54 -0800 Subject: [PATCH] Add a SIGALRM handler that does nothing This will be part of a future signal torture-test, to ensure we are handling EINTR correctly --- src/signal.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/signal.cpp b/src/signal.cpp index 64a7c80af..aa76e8d33 100644 --- a/src/signal.cpp +++ b/src/signal.cpp @@ -242,6 +242,15 @@ static void handle_chld(int sig, siginfo_t *info, void *context) { default_handler(sig, info, context); } +// We have a sigalarm handler that does nothing +// This is used in the signal torture test, to verify +// that we behave correctly when receiving lots of irrelevant signals +static void handle_sigalarm(int sig, siginfo_t *info, void *context) { + UNUSED(sig); + UNUSED(info); + UNUSED(context); +} + void signal_reset_handlers() { int i; @@ -285,6 +294,11 @@ static void set_interactive_handlers() { act.sa_flags = SA_SIGINFO; sigaction(SIGHUP, &act, 0); + // SIGALARM as part of our signal torture test + act.sa_sigaction = &handle_sigalarm; + act.sa_flags = SA_SIGINFO; + sigaction(SIGALRM, &act, 0); + #ifdef SIGWINCH act.sa_sigaction = &handle_winch; act.sa_flags = SA_SIGINFO;