Merge pull request #1239 from poettering/cgroup-pids
authorDaniel Mack <github@zonque.org>
Thu, 10 Sep 2015 17:11:29 +0000 (19:11 +0200)
committerDaniel Mack <github@zonque.org>
Thu, 10 Sep 2015 17:11:29 +0000 (19:11 +0200)
core: add support for the "pids" cgroup controller

1  2 
src/cgtop/cgtop.c
src/core/load-fragment.c
src/shared/bus-util.c
src/systemctl/systemctl.c

Simple merge
@@@ -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;
          }
  
@@@ -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;
  
Simple merge