diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-01-17 15:39:39 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-01-22 16:26:55 +0100 |
commit | c36a69f4cd8f835260e73941b14dff58e6f53e60 (patch) | |
tree | 3d771f6b34a5d7aea15103d431d763a503e0f0d7 /src | |
parent | cgroup: add proper API to determine whether our unit manags to root cgroup (diff) | |
download | systemd-c36a69f4cd8f835260e73941b14dff58e6f53e60.tar.xz systemd-c36a69f4cd8f835260e73941b14dff58e6f53e60.zip |
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')
-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 a4974d28f6..c779859e4b 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" @@ -2271,6 +2272,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; |