X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fscope.c;h=e8f9e8dd738ab56faaf5cfa3b678684f21af9c38;hb=5261ba901845c084de5a8fd06500ed09bfb0bd80;hp=be2a6370239f0762c327dcb6606100602c019d05;hpb=085afe36cb823e7d5b8c5f3ef21ebb9639bac78b;p=elogind.git diff --git a/src/core/scope.c b/src/core/scope.c index be2a63702..e8f9e8dd7 100644 --- a/src/core/scope.c +++ b/src/core/scope.c @@ -51,11 +51,6 @@ static void scope_init(Unit *u) { s->timeout_stop_usec = u->manager->default_timeout_stop_usec; - cgroup_context_init(&s->cgroup_context); - kill_context_init(&s->kill_context); - - unit_cgroup_context_init_defaults(u, &s->cgroup_context); - UNIT(s)->ignore_on_isolate = true; UNIT(s)->ignore_on_snapshot = true; } @@ -65,8 +60,6 @@ static void scope_done(Unit *u) { assert(u); - cgroup_context_done(&s->cgroup_context); - free(s->controller); s->timer_event_source = sd_event_source_unref(s->timer_event_source); @@ -90,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) { @@ -158,7 +156,11 @@ static int scope_load(Unit *u) { if (r < 0) return r; - r = unit_add_default_slice(u); + r = unit_patch_contexts(u); + if (r < 0) + return r; + + r = unit_add_default_slice(u, &s->cgroup_context); if (r < 0) return r;