summaryrefslogtreecommitdiff
path: root/lib/igt_core.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2015-03-19 08:29:51 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2015-03-26 08:15:18 +0000
commit2fa35c7316c26a469c0076a1a98c0b0a715b3386 (patch)
treeaa726a661b1e97d9f604c96e07c4d48bde55a6c6 /lib/igt_core.c
parent559987fc01f16f010681fedff69ffe8fb2231d50 (diff)
lib/core: Silence internally used signals
We use SIGTERM to kill off child processes. We use it a lot. Reporting everytime we use it is just spam. Treat the similar user signals (SIGINT, SIGQUIT and the should-never-have-been SIGPIPE) similarly to reduce noise. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Thomas Wood <thomas.wood@intel.com>
Diffstat (limited to 'lib/igt_core.c')
-rw-r--r--lib/igt_core.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 962b878c..61b3a338 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -1304,9 +1304,12 @@ static igt_exit_handler_t exit_handler_fn[MAX_EXIT_HANDLERS];
static bool exit_handler_disabled;
static sigset_t saved_sig_mask;
#define SIGDEF(x) { x, #x, sizeof(#x) - 1 }
+#define SILENT(x) { x, NULL, 0 }
static const struct { int number; const char *name; size_t name_len; } handled_signals[] =
- { SIGDEF(SIGINT), SIGDEF(SIGHUP), SIGDEF(SIGTERM), SIGDEF(SIGQUIT),
- SIGDEF(SIGPIPE), SIGDEF(SIGABRT), SIGDEF(SIGSEGV), SIGDEF(SIGBUS) };
+ { SILENT(SIGINT), SILENT(SIGHUP), SILENT(SIGTERM), SILENT(SIGQUIT),
+ SILENT(SIGPIPE), SIGDEF(SIGABRT), SIGDEF(SIGSEGV), SIGDEF(SIGBUS) };
+#undef SILENT
+#undef SIGDEF
static int install_sig_handler(int sig_num, sighandler_t handler)
{
@@ -1364,13 +1367,17 @@ static void fatal_sig_handler(int sig)
restore_all_sig_handler();
for (i = 0; i < ARRAY_SIZE(handled_signals); i++) {
- if (handled_signals[i].number == sig) {
+ if (handled_signals[i].number != sig)
+ continue;
+
+ if (handled_signals[i].name_len) {
write(STDERR_FILENO, "Received signal ", 16);
write(STDERR_FILENO, handled_signals[i].name,
handled_signals[i].name_len);
write(STDERR_FILENO, ".\n", 2);
- break;
}
+
+ break;
}
/*