summaryrefslogtreecommitdiff
path: root/src/core/unit.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-01-29 13:38:55 +0100
committerLennart Poettering <lennart@poettering.net>2014-01-29 13:42:06 +0100
commit58ea275a68cd242ad60161bcb7582614d1d89f13 (patch)
tree13573e930a8e30caf8e47e0658cc0522575bf713 /src/core/unit.c
parent373f14222e6ff11ad0b129b033e01f75f7c504f3 (diff)
core: introduce new KillMode=mixed which sends SIGTERM only to the main process, but SIGKILL to all daemon processes
This should fix some race with terminating systemd --user, where the system systemd instance might race against the user systemd instance when sending SIGTERM.
Diffstat (limited to 'src/core/unit.c')
-rw-r--r--src/core/unit.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index e5ea994e5..0ad679ba6 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2966,7 +2966,7 @@ int unit_kill_context(
}
}
- if (c->kill_mode == KILL_CONTROL_GROUP && u->cgroup_path) {
+ if ((c->kill_mode == KILL_CONTROL_GROUP || (c->kill_mode == KILL_MIXED && sigkill)) && u->cgroup_path) {
_cleanup_set_free_ Set *pid_set = NULL;
/* Exclude the main/control pids from being killed via the cgroup */
@@ -2980,6 +2980,7 @@ int unit_kill_context(
log_warning_unit(u->id, "Failed to kill control group: %s", strerror(-r));
} else if (r > 0) {
wait_for_exit = true;
+
if (c->send_sighup) {
set_free(pid_set);