X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fscope.c;h=a2b9265061afc5b0ce1b4458cca2b317831b665b;hb=12f1caf40c8bbc8302c8458a364515628e621fa5;hp=aa4978de4c8e28a1257a9df2d63e24ddae033d67;hpb=598459cebac7cc93089769a992e7b03287f77e12;p=elogind.git diff --git a/src/core/scope.c b/src/core/scope.c index aa4978de4..a2b926506 100644 --- a/src/core/scope.c +++ b/src/core/scope.c @@ -83,7 +83,12 @@ static int scope_arm_timer(Scope *s) { return sd_event_source_set_enabled(s->timer_event_source, SD_EVENT_ONESHOT); } - return sd_event_add_monotonic(UNIT(s)->manager->event, &s->timer_event_source, now(CLOCK_MONOTONIC) + s->timeout_stop_usec, 0, scope_dispatch_timer, s); + return sd_event_add_time( + UNIT(s)->manager->event, + &s->timer_event_source, + CLOCK_MONOTONIC, + now(CLOCK_MONOTONIC) + s->timeout_stop_usec, 0, + scope_dispatch_timer, s); } static void scope_set_state(Scope *s, ScopeState state) { @@ -128,7 +133,7 @@ static int scope_verify(Scope *s) { return 0; if (set_isempty(UNIT(s)->pids) && UNIT(s)->manager->n_reloading <= 0) { - log_error_unit(UNIT(s)->id, "Scope %s has no PIDs. Refusing.", UNIT(s)->id); + log_unit_error(UNIT(s)->id, "Scope %s has no PIDs. Refusing.", UNIT(s)->id); return -EINVAL; } @@ -238,7 +243,7 @@ static void scope_enter_signal(Scope *s, ScopeState state, ScopeResult f) { r = unit_kill_context( UNIT(s), &s->kill_context, - state != SCOPE_STOP_SIGTERM, + state != SCOPE_STOP_SIGTERM ? KILL_KILL : KILL_TERMINATE, -1, -1, false); if (r < 0) goto fail; @@ -259,7 +264,7 @@ static void scope_enter_signal(Scope *s, ScopeState state, ScopeResult f) { return; fail: - log_warning_unit(UNIT(s)->id, + log_unit_warning(UNIT(s)->id, "%s failed to kill processes: %s", UNIT(s)->id, strerror(-r)); scope_enter_dead(s, SCOPE_FAILURE_RESOURCES); @@ -400,7 +405,7 @@ static void scope_notify_cgroup_empty_event(Unit *u) { Scope *s = SCOPE(u); assert(u); - log_debug_unit(u->id, "%s: cgroup is empty", u->id); + log_unit_debug(u->id, "%s: cgroup is empty", u->id); if (IN_SET(s->state, SCOPE_RUNNING, SCOPE_ABANDONED, SCOPE_STOP_SIGTERM, SCOPE_STOP_SIGKILL)) scope_enter_dead(s, SCOPE_SUCCESS); @@ -432,17 +437,17 @@ static int scope_dispatch_timer(sd_event_source *source, usec_t usec, void *user case SCOPE_STOP_SIGTERM: if (s->kill_context.send_sigkill) { - log_warning_unit(UNIT(s)->id, "%s stopping timed out. Killing.", UNIT(s)->id); + log_unit_warning(UNIT(s)->id, "%s stopping timed out. Killing.", UNIT(s)->id); scope_enter_signal(s, SCOPE_STOP_SIGKILL, SCOPE_FAILURE_TIMEOUT); } else { - log_warning_unit(UNIT(s)->id, "%s stopping timed out. Skipping SIGKILL.", UNIT(s)->id); + log_unit_warning(UNIT(s)->id, "%s stopping timed out. Skipping SIGKILL.", UNIT(s)->id); scope_enter_dead(s, SCOPE_FAILURE_TIMEOUT); } break; case SCOPE_STOP_SIGKILL: - log_warning_unit(UNIT(s)->id, "%s still around after SIGKILL. Ignoring.", UNIT(s)->id); + log_unit_warning(UNIT(s)->id, "%s still around after SIGKILL. Ignoring.", UNIT(s)->id); scope_enter_dead(s, SCOPE_FAILURE_TIMEOUT); break;