if (UNIT(s)->load_state != UNIT_LOADED)
return 0;
- if (set_size(s->pids) <= 0) {
+ if (set_size(s->pids) <= 0 && UNIT(s)->manager->n_reloading <= 0) {
log_error_unit(UNIT(s)->id, "Scope %s has no PIDs. Refusing.", UNIT(s)->id);
return -EINVAL;
}
assert(s);
+ if (s->state == SCOPE_FAILED)
+ return -EPERM;
+
if (s->state == SCOPE_STOP_SIGTERM ||
s->state == SCOPE_STOP_SIGKILL)
return -EAGAIN;
return r;
}
- r = cg_attach_many_with_mask(u->cgroup_mask, u->cgroup_path, s->pids);
+ r = cg_attach_many_everywhere(u->manager->cgroup_supported, u->cgroup_path, s->pids);
if (r < 0)
return r;
return 0;
}
+static void scope_reset_failed(Unit *u) {
+ Scope *s = SCOPE(u);
+
+ assert(s);
+
+ if (s->state == SCOPE_FAILED)
+ scope_set_state(s, SCOPE_DEAD);
+
+ s->result = SCOPE_SUCCESS;
+}
+
static int scope_kill(Unit *u, KillWho who, int signo, DBusError *error) {
return unit_kill_common(u, who, signo, -1, -1, error);
}
static const char* const scope_state_table[_SCOPE_STATE_MAX] = {
[SCOPE_DEAD] = "dead",
- [SCOPE_RUNNING] = "active",
+ [SCOPE_RUNNING] = "running",
[SCOPE_STOP_SIGTERM] = "stop-sigterm",
[SCOPE_STOP_SIGKILL] = "stop-sigkill",
[SCOPE_FAILED] = "failed",
.timer_event = scope_timer_event,
+ .reset_failed = scope_reset_failed,
+
.notify_cgroup_empty = scope_notify_cgroup_empty_event,
.bus_interface = "org.freedesktop.systemd1.Scope",