diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-02-27 18:50:41 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-02-27 18:50:41 +0100 |
commit | 26d04f86a36595e3565c74d67863e076c3e3c773 (patch) | |
tree | 374ba1bdf5dfc95a9c05df1232ffc44d8bd98397 /src/core/dbus-manager.c | |
parent | 416389f7ae262ae7a0848302e7a6516597f9fad1 (diff) |
unit: rework resource management API
This introduces a new static list of known attributes and their special
semantics. This means that cgroup attribute values can now be
automatically translated from user to kernel notation for command line
set settings, too.
This also adds proper support for multi-line attributes.
Diffstat (limited to 'src/core/dbus-manager.c')
-rw-r--r-- | src/core/dbus-manager.c | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index de23369397..8f4bbc59b7 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -103,30 +103,31 @@ " <method name=\"ResetFailedUnit\">\n" \ " <arg name=\"name\" type=\"s\" direction=\"in\"/>\n" \ " </method>\n" \ - " <method name=\"GetUnitControlGroupAttributes\">\n" \ + " <method name=\"SetUnitControlGroup\">\n" \ " <arg name=\"name\" type=\"s\" direction=\"in\"/>\n" \ - " <arg name=\"attributes\" type=\"as\" direction=\"in\"/>\n" \ - " <arg name=\"values\" type=\"as\" direction=\"out\"/>\n" \ + " <arg name=\"group\" type=\"s\" direction=\"in\"/>\n" \ + " <arg name=\"mode\" type=\"s\" direction=\"in\"/>\n" \ " </method>\n" \ - " <method name=\"SetUnitControlGroupAttributes\">\n" \ + " <method name=\"UnsetUnitControlGroup\">\n" \ " <arg name=\"name\" type=\"s\" direction=\"in\"/>\n" \ - " <arg name=\"attributes\" type=\"a(sss)\" direction=\"in\"/>\n" \ + " <arg name=\"group\" type=\"s\" direction=\"in\"/>\n" \ " <arg name=\"mode\" type=\"s\" direction=\"in\"\n/>" \ " </method>\n" \ - " <method name=\"UnsetUnitControlGroupAttributes\">\n" \ + " <method name=\"GetUnitControlGroupAttribute\">\n" \ " <arg name=\"name\" type=\"s\" direction=\"in\"/>\n" \ - " <arg name=\"attributes\" type=\"a(ss)\" direction=\"in\"/>\n" \ - " <arg name=\"mode\" type=\"s\" direction=\"in\"/>\n" \ + " <arg name=\"attribute\" type=\"s\" direction=\"in\"/>\n" \ + " <arg name=\"values\" type=\"as\" direction=\"out\"/>\n" \ " </method>\n" \ - " <method name=\"SetUnitControlGroups\">\n" \ + " <method name=\"SetUnitControlGroupAttribute\">\n" \ " <arg name=\"name\" type=\"s\" direction=\"in\"/>\n" \ - " <arg name=\"groups\" type=\"as\" direction=\"in\"/>\n" \ - " <arg name=\"mode\" type=\"s\" direction=\"in\"/>\n" \ + " <arg name=\"attribute\" type=\"s\" direction=\"in\"/>\n" \ + " <arg name=\"values\" type=\"as\" direction=\"in\"/>\n" \ + " <arg name=\"mode\" type=\"s\" direction=\"in\"\n/>" \ " </method>\n" \ - " <method name=\"UnsetUnitControlGroups\">\n" \ + " <method name=\"UnsetUnitControlGroupAttributes\">\n" \ " <arg name=\"name\" type=\"s\" direction=\"in\"/>\n" \ - " <arg name=\"groups\" type=\"as\" direction=\"in\"/>\n" \ - " <arg name=\"mode\" type=\"s\" direction=\"in\"\n/>" \ + " <arg name=\"attribute\" type=\"s\" direction=\"in\"/>\n" \ + " <arg name=\"mode\" type=\"s\" direction=\"in\"/>\n" \ " </method>\n" \ " <method name=\"GetJob\">\n" \ " <arg name=\"id\" type=\"u\" direction=\"in\"/>\n" \ @@ -874,7 +875,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, if (!reply) goto oom; - } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "SetUnitControlGroups")) { + } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "SetUnitControlGroup")) { const char *name; Unit *u; DBusMessageIter iter; @@ -902,7 +903,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, if (!reply) goto oom; - } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "UnsetUnitControlGroups")) { + } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "UnsetUnitControlGroup")) { const char *name; Unit *u; DBusMessageIter iter; @@ -930,7 +931,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, if (!reply) goto oom; - } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "SetUnitControlGroupAttributes")) { + } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "SetUnitControlGroupAttribute")) { const char *name; Unit *u; DBusMessageIter iter; @@ -949,6 +950,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, } SELINUX_UNIT_ACCESS_CHECK(u, connection, message, "start"); + r = bus_unit_cgroup_attribute_set(u, &iter); if (r < 0) return bus_send_error_reply(connection, message, NULL, r); @@ -957,7 +959,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, if (!reply) goto oom; - } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "UnsetUnitControlGroupAttributes")) { + } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "UnsetUnitControlGroupAttribute")) { const char *name; Unit *u; DBusMessageIter iter; @@ -985,7 +987,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, if (!reply) goto oom; - } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "GetUnitControlGroupAttributes")) { + } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "GetUnitControlGroupAttribute")) { const char *name; Unit *u; DBusMessageIter iter; @@ -1005,6 +1007,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, } SELINUX_UNIT_ACCESS_CHECK(u, connection, message, "status"); + r = bus_unit_cgroup_attribute_get(u, &iter, &list); if (r < 0) return bus_send_error_reply(connection, message, NULL, r); |