diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-06-27 21:14:56 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-06-27 21:14:56 +0200 |
commit | 8e2af478402414f060bbc16e1b4bbe7de1779c13 (patch) | |
tree | 2548caac0cda5efadd459e3a4e3744449d57a181 /src/core/dbus-slice.c | |
parent | aae72d6fa0910891aa446ec43c548512987d453a (diff) |
dbus: add infrastructure for changing multiple properties at once on units and hook some cgroup attributes up to it
This introduces two bus calls to make runtime changes to selected bus
properties, optionally with persistence.
This currently hooks this up only for three cgroup atributes, but this
brings the infrastructure to add more changable attributes.
This allows setting multiple attributes at once, and takes an array
rather than a dictionary of properties, in order to implement simple
resetting of lists using the same approach as when they are sourced from
unit files. This means, that list properties are appended to by this
call, unless they are first reset via assigning the empty list.
Diffstat (limited to 'src/core/dbus-slice.c')
-rw-r--r-- | src/core/dbus-slice.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/core/dbus-slice.c b/src/core/dbus-slice.c index 8243305848..db356adf30 100644 --- a/src/core/dbus-slice.c +++ b/src/core/dbus-slice.c @@ -53,10 +53,38 @@ DBusHandlerResult bus_slice_message_handler(Unit *u, DBusConnection *c, DBusMess const BusBoundProperties bps[] = { { "org.freedesktop.systemd1.Unit", bus_unit_properties, u }, { "org.freedesktop.systemd1.Slice", bus_cgroup_context_properties, &s->cgroup_context }, - { NULL, } + {} }; SELINUX_UNIT_ACCESS_CHECK(u, c, message, "status"); return bus_default_message_handler(c, message, INTROSPECTION, INTERFACES_LIST, bps); } + +int bus_slice_set_property( + Unit *u, + const char *name, + DBusMessageIter *i, + UnitSetPropertiesMode mode, + DBusError *error) { + + Slice *s = SLICE(u); + int r; + + assert(name); + assert(u); + assert(i); + + r = bus_cgroup_set_property(u, &s->cgroup_context, name, i, mode, error); + if (r != 0) + return r; + + return 0; +} + +int bus_slice_commit_properties(Unit *u) { + assert(u); + + unit_realize_cgroup(u); + return 0; +} |