From: Daniel Mack Date: Thu, 10 Sep 2015 17:11:29 +0000 (+0200) Subject: Merge pull request #1239 from poettering/cgroup-pids X-Git-Tag: v227~145 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a18f3caa5613196700062e5f4cf55f36a3f76f2c;p=thirdparty%2Fsystemd.git Merge pull request #1239 from poettering/cgroup-pids core: add support for the "pids" cgroup controller --- a18f3caa5613196700062e5f4cf55f36a3f76f2c diff --cc src/core/load-fragment.c index 00cc6f7373d,07f27705598..f7a8539910d --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@@ -2683,18 -2683,19 +2683,17 @@@ int config_parse_memory_limit void *userdata) { CGroupContext *c = data; - off_t bytes; + uint64_t bytes; int r; - if (isempty(rvalue)) { + if (isempty(rvalue) || streq(rvalue, "infinity")) { c->memory_limit = (uint64_t) -1; return 0; } - assert_cc(sizeof(uint64_t) == sizeof(off_t)); - r = parse_size(rvalue, 1024, &bytes); - if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, EINVAL, - "Memory limit '%s' invalid. Ignoring.", rvalue); + if (r < 0 || bytes < 1) { + log_syntax(unit, LOG_ERR, filename, line, EINVAL, "Memory limit '%s' invalid. Ignoring.", rvalue); return 0; } diff --cc src/shared/bus-util.c index 64a810fc8f9,0ca1bbfb213..4dc4ca581d3 --- a/src/shared/bus-util.c +++ b/src/shared/bus-util.c @@@ -1434,16 -1434,35 +1434,35 @@@ int bus_append_unit_property_assignment r = sd_bus_message_append(m, "v", "b", r); } else if (streq(field, "MemoryLimit")) { - off_t bytes; + uint64_t bytes; - r = parse_size(eq, 1024, &bytes); - if (r < 0) { - log_error("Failed to parse bytes specification %s", assignment); - return -EINVAL; + if (isempty(eq) || streq(eq, "infinity")) + bytes = (uint64_t) -1; + else { + r = parse_size(eq, 1024, &bytes); + if (r < 0) { + log_error("Failed to parse bytes specification %s", assignment); + return -EINVAL; + } } - r = sd_bus_message_append(m, "v", "t", (uint64_t) bytes); + r = sd_bus_message_append(m, "v", "t", bytes); + } else if (streq(field, "TasksMax")) { + uint64_t n; + + if (isempty(eq) || streq(eq, "infinity")) + n = (uint64_t) -1; + else { + r = safe_atou64(eq, &n); + if (r < 0) { + log_error("Failed to parse maximum tasks specification %s", assignment); + return -EINVAL; + } + } + + r = sd_bus_message_append(m, "v", "t", n); + } else if (STR_IN_SET(field, "CPUShares", "BlockIOWeight")) { uint64_t u;