summaryrefslogtreecommitdiff
path: root/src/basic/cgroup-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-07-25 22:23:00 +0200
committerGitHub <noreply@github.com>2016-07-25 22:23:00 +0200
commit1a0b98c43797ce96e47b110a58f0b4c55f3256f5 (patch)
treede31763744776a796fa929009a79eafafb2d2964 /src/basic/cgroup-util.c
parentc92fcc4f4375b0aebc5919311bbf703138b21918 (diff)
parent0996ef00fb5c0770d49670f81a230fcc2552af89 (diff)
Merge pull request #3589 from brauner/cgroup_namespace
Cgroup namespace
Diffstat (limited to 'src/basic/cgroup-util.c')
-rw-r--r--src/basic/cgroup-util.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
index 472e24b7a3..302b958d0d 100644
--- a/src/basic/cgroup-util.c
+++ b/src/basic/cgroup-util.c
@@ -134,6 +134,20 @@ int cg_read_event(const char *controller, const char *path, const char *event,
return -ENOENT;
}
+bool cg_ns_supported(void) {
+ static thread_local int enabled = -1;
+
+ if (enabled >= 0)
+ return enabled;
+
+ if (access("/proc/self/ns/cgroup", F_OK) == 0)
+ enabled = 1;
+ else
+ enabled = 0;
+
+ return enabled;
+}
+
int cg_enumerate_subgroups(const char *controller, const char *path, DIR **_d) {
_cleanup_free_ char *fs = NULL;
int r;