chiark / gitweb /
core: in containers, don't wait for cgroup empty notifications which will never come
[elogind.git] / src / core / scope.c
index a3c94794b1eb4740df9cad886f799ba4ed3991c8..5beb4f80c427c65ed8d0588379ef92e34cceb5ed 100644 (file)
@@ -238,7 +238,9 @@ static void scope_enter_signal(Scope *s, ScopeState state, ScopeResult f) {
                         goto fail;
 
                 scope_set_state(s, state);
-        } else
+        } else if (state == SCOPE_STOP_SIGTERM)
+                scope_enter_signal(s, SCOPE_STOP_SIGKILL, SCOPE_SUCCESS);
+        else
                 scope_enter_dead(s, SCOPE_SUCCESS);
 
         return;
@@ -318,6 +320,20 @@ static int scope_kill(Unit *u, KillWho who, int signo, sd_bus_error *error) {
         return unit_kill_common(u, who, signo, -1, -1, error);
 }
 
+static int scope_get_timeout(Unit *u, uint64_t *timeout) {
+        Scope *s = SCOPE(u);
+        int r;
+
+        if (!s->timer_event_source)
+                return 0;
+
+        r = sd_event_source_get_time(s->timer_event_source, timeout);
+        if (r < 0)
+                return r;
+
+        return 1;
+}
+
 static int scope_serialize(Unit *u, FILE *f, FDSet *fds) {
         Scope *s = SCOPE(u);
 
@@ -478,6 +494,8 @@ const UnitVTable scope_vtable = {
 
         .kill = scope_kill,
 
+        .get_timeout = scope_get_timeout,
+
         .serialize = scope_serialize,
         .deserialize_item = scope_deserialize_item,
 
@@ -492,7 +510,6 @@ const UnitVTable scope_vtable = {
 
         .bus_interface = "org.freedesktop.systemd1.Scope",
         .bus_vtable = bus_scope_vtable,
-        .bus_changing_properties = bus_scope_changing_properties,
         .bus_set_property = bus_scope_set_property,
         .bus_commit_properties = bus_scope_commit_properties,