diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-06-27 21:50:35 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-06-27 21:50:35 +0200 |
commit | b42defe3b8ed3947d85db654a6cdb1b9999f394d (patch) | |
tree | c5ff15f05ca1a314cb76ce144f2da79b80cac9d6 /src/systemctl/systemctl.c | |
parent | 8e2af478402414f060bbc16e1b4bbe7de1779c13 (diff) |
dbus: make more cgroup attributes runtime settable
Diffstat (limited to 'src/systemctl/systemctl.c')
-rw-r--r-- | src/systemctl/systemctl.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 1f81bda7e3..5048b529e1 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -3632,6 +3632,35 @@ static int append_assignment(DBusMessageIter *iter, const char *assignment) { if (!dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT, "b", &sub) || !dbus_message_iter_append_basic(&sub, DBUS_TYPE_BOOLEAN, &b)) return log_oom(); + + } else if (streq(field, "MemoryLimit") || streq(field, "MemorySoftLimit")) { + off_t bytes; + uint64_t u; + + r = parse_bytes(eq, &bytes); + if (r < 0) { + log_error("Failed to parse bytes specification %s", assignment); + return -EINVAL; + } + + u = bytes; + if (!dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT, "t", &sub) || + !dbus_message_iter_append_basic(&sub, DBUS_TYPE_UINT64, &u)) + return log_oom(); + + } else if (streq(field, "CPUShares") || streq(field, "BlockIOWeight")) { + uint64_t u; + + r = safe_atou64(eq, &u); + if (r < 0) { + log_error("Failed to parse %s value %s.", field, eq); + return -EINVAL; + } + + if (!dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT, "t", &sub) || + !dbus_message_iter_append_basic(&sub, DBUS_TYPE_UINT64, &u)) + return log_oom(); + } else { log_error("Unknown assignment %s.", assignment); return -EINVAL; |