#include <unistd.h>
#include "alloc-util.h"
+#include "cgroup-setup.h"
#include "dbus-scope.h"
#include "dbus-unit.h"
#include "exit-status.h"
old_state = s->state;
s->state = state;
- if (!IN_SET(state, SCOPE_STOP_SIGTERM, SCOPE_STOP_SIGKILL, SCOPE_START_CHOWN))
+ if (!IN_SET(state, SCOPE_STOP_SIGTERM, SCOPE_STOP_SIGKILL, SCOPE_START_CHOWN, SCOPE_RUNNING))
s->timer_event_source = sd_event_source_disable_unref(s->timer_event_source);
if (IN_SET(state, SCOPE_DEAD, SCOPE_FAILED)) {
if (state != old_state)
log_debug("%s changed %s -> %s", UNIT(s)->id, scope_state_to_string(old_state), scope_state_to_string(state));
- unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state], 0);
+ unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state], /* reload_success = */ true);
}
static int scope_add_default_dependencies(Scope *s) {
s->result = SCOPE_SUCCESS;
}
-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_kill(Unit *u, KillWho who, int signo, int code, int value, sd_bus_error *error) {
+ return unit_kill_common(u, who, signo, code, value, -1, -1, error);
}
static int scope_get_timeout(Unit *u, usec_t *timeout) {
if (IN_SET(s->state, SCOPE_RUNNING, SCOPE_ABANDONED, SCOPE_STOP_SIGTERM, SCOPE_STOP_SIGKILL))
scope_enter_dead(s, SCOPE_SUCCESS);
-
- /* If the cgroup empty notification comes when the unit is not active, we must have failed to clean
- * up the cgroup earlier and should do it now. */
- if (IN_SET(s->state, SCOPE_DEAD, SCOPE_FAILED))
- unit_prune_cgroup(u);
}
static void scope_notify_cgroup_oom_event(Unit *u, bool managed_oom) {
return 0;
}
-_pure_ static UnitActiveState scope_active_state(Unit *u) {
+static UnitActiveState scope_active_state(Unit *u) {
assert(u);
return state_translation_table[SCOPE(u)->state];
}
-_pure_ static const char *scope_sub_state_to_string(Unit *u) {
+static const char *scope_sub_state_to_string(Unit *u) {
assert(u);
return scope_state_to_string(SCOPE(u)->state);
unit_add_to_load_queue(u);
unit_add_to_dbus_queue(u);
+ /* Enqueue an explicit cgroup realization here. Unlike other cgroups this one already exists and is
+ * populated (by us, after all!) already, even when we are not in a reload cycle. Hence we cannot
+ * apply the settings at creation time anymore, but let's at least apply them asynchronously. */
+ unit_add_to_cgroup_realize_queue(u);
}
static const char* const scope_result_table[_SCOPE_RESULT_MAX] = {