diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-01-19 01:01:41 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-01-19 01:02:30 +0100 |
commit | 71645acac27da55d510f2e4d61cc61b4e5b93035 (patch) | |
tree | be5b435bb0c0ccaeee51b69beae571ddd3b5efd4 /src/systemctl | |
parent | e884315e3d28df0d5f4e7d4590730e9760b8f447 (diff) |
unit: optionally allow making cgroup attribute changes persistent
Diffstat (limited to 'src/systemctl')
-rw-r--r-- | src/systemctl/systemctl.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index fb4ae24ed6..408a4f0506 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -2177,6 +2177,7 @@ static int set_cgroup(DBusConnection *bus, char **args) { DBusMessageIter iter; int r; _cleanup_free_ char *n = NULL; + const char *runtime; assert(bus); assert(args); @@ -2208,6 +2209,10 @@ static int set_cgroup(DBusConnection *bus, char **args) { if (r < 0) return log_oom(); + runtime = arg_runtime ? "runtime" : "persistent"; + if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &runtime)) + return log_oom(); + reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error); if (!reply) { log_error("Failed to issue method call: %s", bus_error_message(&error)); @@ -2224,6 +2229,7 @@ static int set_cgroup_attr(DBusConnection *bus, char **args) { DBusMessageIter iter, sub, sub2; char **x, **y; _cleanup_free_ char *n = NULL; + const char *runtime; assert(bus); assert(args); @@ -2260,8 +2266,10 @@ static int set_cgroup_attr(DBusConnection *bus, char **args) { return log_oom(); } - if (!dbus_message_iter_close_container(&iter, &sub)) - return -ENOMEM; + runtime = arg_runtime ? "runtime" : "persistent"; + if (!dbus_message_iter_close_container(&iter, &sub) || + !dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &runtime)) + return log_oom(); reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error); if (!reply) { @@ -3163,7 +3171,7 @@ static int print_property(const char *name, DBusMessageIter *iter) { bus_iter_get_basic_and_next(&sub2, DBUS_TYPE_STRING, &attr, true) >= 0 && bus_iter_get_basic_and_next(&sub2, DBUS_TYPE_STRING, &value, false) >= 0) { - printf("ControlGroupAttribute={ controller=%s ; attribute=%s ; value=\"%s\" }\n", + printf("ControlGroupAttributes={ controller=%s ; attribute=%s ; value=\"%s\" }\n", controller, attr, value); |