diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-01-17 15:39:39 +0100 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2018-05-30 07:50:17 +0200 |
commit | a696ccac5a53620d1652b10218a7f62647a2c501 (patch) | |
tree | 0ef0f8fb41da3cfbbfed3156f49cf65d46eae878 /src/core | |
parent | e944316f6eecad97dd6abe1f9e0fbd05aead7442 (diff) |
cgroup: when querying the number of tasks in the root slice use the pid_max sysctl
The root cgroup doesn't expose and properties in the "pids" cgroup
controller, hence we need to get the data from somewhere else.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/cgroup.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/core/cgroup.c b/src/core/cgroup.c index 2e70aa79a..153a0dda8 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -32,6 +32,7 @@ #include "parse-util.h" #include "path-util.h" #include "process-util.h" +//#include "procfs-util.h" //#include "special.h" #include "stdio-util.h" #include "string-table.h" @@ -2330,6 +2331,10 @@ int unit_get_tasks_current(Unit *u, uint64_t *ret) { if ((u->cgroup_realized_mask & CGROUP_MASK_PIDS) == 0) return -ENODATA; + /* The root cgroup doesn't expose this information, let's get it from /proc instead */ + if (unit_has_root_cgroup(u)) + return procfs_tasks_get_current(ret); + r = cg_get_attribute("pids", u->cgroup_path, "pids.current", &v); if (r == -ENOENT) return -ENODATA; |