From 4f7d4dcae56e5f993f3f0b331556d4df3b0b33ab Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 21 Jul 2014 07:54:29 +0100 Subject: [PATCH] Use SIGTERM in replace of SIGQUIT SIGTERM is the normal signal to use when instructing a process to exit. The only difference is that an unhandled SIGQUIT is meant to generate a coredump, which is not what we want, but in practice I encountered an issue where SIGTERM seemed to be deliverable more reliably than SIGQUIT (in tests using multiple signal helpers). Signed-off-by: Chris Wilson --- lib/igt_core.c | 9 +++++---- lib/igt_core.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/igt_core.c b/lib/igt_core.c index 5faf98ea..b197932a 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -761,7 +761,7 @@ static void fork_helper_exit_handler(int sig) /* Someone forgot to fill up the array? */ assert(pid != 0); - ret = kill(pid, SIGQUIT); + ret = kill(pid, SIGTERM); assert(ret == 0); while (waitpid(pid, &status, 0) == -1 && errno == EINTR) @@ -821,13 +821,14 @@ void igt_stop_helper(struct igt_helper_process *proc) assert(proc->running); ret = kill(proc->pid, - proc->use_SIGKILL ? SIGKILL : SIGQUIT); + proc->use_SIGKILL ? SIGKILL : SIGTERM); assert(ret == 0); + while (waitpid(proc->pid, &status, 0) == -1 && errno == EINTR) ; igt_assert(WIFSIGNALED(status) && - WTERMSIG(status) == (proc->use_SIGKILL ? SIGKILL : SIGQUIT)); + WTERMSIG(status) == (proc->use_SIGKILL ? SIGKILL : SIGTERM)); proc->running = false; @@ -867,7 +868,7 @@ static void children_exit_handler(int sig) for (int nc = 0; nc < num_test_children; nc++) { int status = -1; - ret = kill(test_children[nc], SIGQUIT); + ret = kill(test_children[nc], SIGTERM); assert(ret == 0); while (waitpid(test_children[nc], &status, 0) == -1 && diff --git a/lib/igt_core.h b/lib/igt_core.h index a30d0d14..61384878 100644 --- a/lib/igt_core.h +++ b/lib/igt_core.h @@ -372,7 +372,7 @@ void igt_waitchildren(void); /** * igt_helper_process_t: * @running: indicates whether the process is currently running - * @use_SIGKILL: whether the helper should be terminated with SIGKILL or SIGQUIT + * @use_SIGKILL: whether the helper should be terminated with SIGKILL or SIGTERM * @pid: pid of the helper if @running is true * @id: internal id *