core: use helper functions like unit_main_pid() in unit_kill_context()

No functional changes. Just refactoring.
This commit is contained in:
Yu Watanabe
2024-01-24 14:43:18 +09:00
parent 3e22239da7
commit b826e31754
7 changed files with 13 additions and 45 deletions
+1 -5
View File
@@ -317,13 +317,9 @@ static void scope_enter_signal(Scope *s, ScopeState state, ScopeResult f) {
else {
r = unit_kill_context(
UNIT(s),
&s->kill_context,
state != SCOPE_STOP_SIGTERM ? KILL_KILL :
s->was_abandoned ? KILL_TERMINATE_AND_LOG :
KILL_TERMINATE,
/* main_pid= */ NULL,
/* control_pid= */ NULL,
/* main_pid_alien= */ false);
KILL_TERMINATE);
if (r < 0) {
log_unit_warning_errno(UNIT(s), r, "Failed to kill processes: %m");
goto fail;