From 61cdc9d8416a27eb33948e9b838e25a8eb07fa5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A5l=20Hermunn=20Johansen?= Date: Tue, 11 Oct 2016 13:42:55 +0200 Subject: [PATCH] New jail level - kill - used when killing is happening A new jail level, JAIL_MASTER_KILL, is introduced. The mgt process takes this level before killing the child process. Fixes: #2010 --- bin/varnishd/mgt/mgt.h | 1 + bin/varnishd/mgt/mgt_child.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/bin/varnishd/mgt/mgt.h b/bin/varnishd/mgt/mgt.h index e59ec7f3cd..a850a08fb4 100644 --- a/bin/varnishd/mgt/mgt.h +++ b/bin/varnishd/mgt/mgt.h @@ -82,6 +82,7 @@ enum jail_master_e { JAIL_MASTER_FILE, JAIL_MASTER_STORAGE, JAIL_MASTER_PRIVPORT, + JAIL_MASTER_KILL, }; typedef int jail_init_f(char **); diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c index 8acde5ee09..d8ab431fa8 100644 --- a/bin/varnishd/mgt/mgt_child.c +++ b/bin/varnishd/mgt/mgt_child.c @@ -459,10 +459,17 @@ mgt_launch_child(struct cli *cli) static int kill_child(void) { + int i, error; + + VJ_master(JAIL_MASTER_KILL); if (MGT_FEATURE(FEATURE_NO_COREDUMP)) - return (kill(child_pid, SIGKILL)); + i = kill(child_pid, SIGKILL); else - return (kill(child_pid, SIGQUIT)); + i = kill(child_pid, SIGQUIT); + error = errno; + VJ_master(JAIL_MASTER_LOW); + errno = error; + return (i); } static void