/* SPDX-License-Identifier: LGPL-2.1+ */
-/***
- This file is part of systemd.
-
- Copyright 2013 Lennart Poettering
-***/
#include <errno.h>
#include "alloc-util.h"
#include "dbus-slice.h"
+#include "dbus-unit.h"
#include "log.h"
+#include "serialize.h"
#include "slice.h"
#include "special.h"
#include "string-util.h"
SliceState old_state;
assert(t);
+ if (t->state != state)
+ bus_unit_send_pending_change_signal(UNIT(t), false);
+
old_state = t->state;
t->state = state;
r = unit_add_two_dependencies_by_name(
UNIT(s),
UNIT_BEFORE, UNIT_CONFLICTS,
- SPECIAL_SHUTDOWN_TARGET, NULL, true, UNIT_DEPENDENCY_DEFAULT);
+ SPECIAL_SHUTDOWN_TARGET, true, UNIT_DEPENDENCY_DEFAULT);
if (r < 0)
return r;
if (!slice_name_is_valid(UNIT(s)->id)) {
log_unit_error(UNIT(s), "Slice name %s is not valid. Refusing.", UNIT(s)->id);
- return -EINVAL;
+ return -ENOEXEC;
}
r = slice_build_parent_slice(UNIT(s)->id, &parent);
if (parent ? !unit_has_name(UNIT_DEREF(UNIT(s)->slice), parent) : UNIT_ISSET(UNIT(s)->slice)) {
log_unit_error(UNIT(s), "Located outside of parent slice. Refusing.");
- return -EINVAL;
+ return -ENOEXEC;
}
return 0;
if (!u->description)
u->description = strdup("Root Slice");
if (!u->documentation)
- u->documentation = strv_new("man:systemd.special(7)", NULL);
+ u->documentation = strv_new("man:systemd.special(7)");
return 1;
}
if (!u->description)
u->description = strdup("System Slice");
if (!u->documentation)
- u->documentation = strv_new("man:systemd.special(7)", NULL);
+ u->documentation = strv_new("man:systemd.special(7)");
return 1;
}
assert(f);
assert(fds);
- unit_serialize_item(u, f, "state", slice_state_to_string(s->state));
+ (void) serialize_item(f, "state", slice_state_to_string(s->state));
+
return 0;
}
assert(m);
r = slice_make_perpetual(m, SPECIAL_ROOT_SLICE, &u);
- if (r >= 0 && manager_owns_root_cgroup(m)) {
+ if (r >= 0 && manager_owns_host_root_cgroup(m)) {
Slice *s = SLICE(u);
/* If we are managing the root cgroup then this means our root slice covers the whole system, which