diff options
author | Daniel Mack <github@zonque.org> | 2015-09-10 19:11:29 +0200 |
---|---|---|
committer | Daniel Mack <github@zonque.org> | 2015-09-10 19:11:29 +0200 |
commit | a18f3caa5613196700062e5f4cf55f36a3f76f2c (patch) | |
tree | 248315bbd774c6111b5e1c10ba52e6ba5e0c499b /src/core/load-fragment.c | |
parent | 786c5bf957f8f7b78c7a0999908ff822e712b53e (diff) | |
parent | 03a7b521e3ffb7f5d153d90480ba5d4bc29d1e8f (diff) |
Merge pull request #1239 from poettering/cgroup-pids
core: add support for the "pids" cgroup controller
Diffstat (limited to 'src/core/load-fragment.c')
-rw-r--r-- | src/core/load-fragment.c | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 00cc6f7373..f7a8539910 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -2686,15 +2686,14 @@ int config_parse_memory_limit( uint64_t bytes; int r; - if (isempty(rvalue)) { + if (isempty(rvalue) || streq(rvalue, "infinity")) { c->memory_limit = (uint64_t) -1; return 0; } 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; } @@ -2702,6 +2701,36 @@ int config_parse_memory_limit( return 0; } +int config_parse_tasks_max( + const char *unit, + const char *filename, + unsigned line, + const char *section, + unsigned section_line, + const char *lvalue, + int ltype, + const char *rvalue, + void *data, + void *userdata) { + + CGroupContext *c = data; + uint64_t u; + int r; + + if (isempty(rvalue) || streq(rvalue, "infinity")) { + c->tasks_max = (uint64_t) -1; + return 0; + } + + r = safe_atou64(rvalue, &u); + if (r < 0 || u < 1) { + log_syntax(unit, LOG_ERR, filename, line, EINVAL, "Maximum tasks value '%s' invalid. Ignoring.", rvalue); + return 0; + } + + return 0; +} + int config_parse_device_allow( const char *unit, const char *filename, |