summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-09-03 19:50:37 +0200
committerLennart Poettering <lennart@poettering.net>2015-09-04 09:07:31 +0200
commit5f4c5fef66581383ee852b301db67f687663004c (patch)
treeefe120b7e83aa5f4f0539a72a26ad1e6f66131da /src/basic
parentba09d9c687986305e5b60f923e85e2ec1e78d979 (diff)
cgroup: always read the supported controllers from the root cgroup of the local container
Otherwise we might end up thinking that we support more controllers than actually enabled for the container we are running in.
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/cgroup-util.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
index fe8750d0f3..388bd629ee 100644
--- a/src/basic/cgroup-util.c
+++ b/src/basic/cgroup-util.c
@@ -1981,14 +1981,22 @@ int cg_mask_supported(CGroupMask *ret) {
if (unified < 0)
return unified;
if (unified > 0) {
- _cleanup_free_ char *controllers = NULL;
+ _cleanup_free_ char *root = NULL, *controllers = NULL, *path = NULL;
const char *c;
/* In the unified hierarchy we can read the supported
* and accessible controllers from a the top-level
* cgroup attribute */
- r = read_one_line_file("/sys/fs/cgroup/cgroup.controllers", &controllers);
+ r = cg_get_root_path(&root);
+ if (r < 0)
+ return r;
+
+ r = cg_get_path(SYSTEMD_CGROUP_CONTROLLER, root, "cgroup.controllers", &path);
+ if (r < 0)
+ return r;
+
+ r = read_one_line_file(path, &controllers);
if (r < 0)
return r;