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/unit.h | |
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/unit.h')
-rw-r--r-- | src/core/unit.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/core/unit.h b/src/core/unit.h index fbcaabe167..c344719b16 100644 --- a/src/core/unit.h +++ b/src/core/unit.h @@ -260,6 +260,12 @@ struct UnitStatusMessageFormats { const char *finished_stop_job[_JOB_RESULT_MAX]; }; +typedef enum UnitSetPropertiesMode { + UNIT_CHECK = 0, + UNIT_RUNTIME = 1, + UNIT_PERSISTENT = 2, +} UnitSetPropertiesMode; + #include "service.h" #include "timer.h" #include "socket.h" @@ -372,6 +378,12 @@ struct UnitVTable { /* Called for each message received on the bus */ DBusHandlerResult (*bus_message_handler)(Unit *u, DBusConnection *c, DBusMessage *message); + /* Called for each property that is being set */ + int (*bus_set_property)(Unit *u, const char *name, DBusMessageIter *i, UnitSetPropertiesMode mode, DBusError *error); + + /* Called after at least one property got changed to apply the necessary change */ + int (*bus_commit_properties)(Unit *u); + /* Return the unit this unit is following */ Unit *(*following)(Unit *u); @@ -577,8 +589,8 @@ int unit_exec_context_defaults(Unit *u, ExecContext *c); ExecContext *unit_get_exec_context(Unit *u) _pure_; CGroupContext *unit_get_cgroup_context(Unit *u) _pure_; -int unit_write_drop_in(Unit *u, bool runtime, const char *name, const char *data); -int unit_remove_drop_in(Unit *u, bool runtime, const char *name); +int unit_write_drop_in(Unit *u, UnitSetPropertiesMode mode, const char *name, const char *data); +int unit_remove_drop_in(Unit *u, UnitSetPropertiesMode mode, const char *name); int unit_kill_context(Unit *u, KillContext *c, bool sigkill, pid_t main_pid, pid_t control_pid, bool main_pid_alien); |