cgfsng: cg_is_pure_unified()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner 2018-02-17 19:20:54 +01:00
parent 96e6f37f51
commit c71d83e17e
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D

View File

@ -1344,19 +1344,20 @@ static bool cg_hybrid_init(void)
return true; return true;
} }
static int cg_is_pure_unified(void) { static int cg_is_pure_unified(void)
{
int ret; int ret;
struct statfs fs; struct statfs fs;
ret = statfs("/sys/fs/cgroup", &fs); ret = statfs("/sys/fs/cgroup", &fs);
if (ret < 0) if (ret < 0)
return -ENOMEDIUM; return -ENOMEDIUM;
if (is_fs_type(&fs, CGROUP2_SUPER_MAGIC)) if (is_fs_type(&fs, CGROUP2_SUPER_MAGIC))
return CGROUP2_SUPER_MAGIC; return CGROUP2_SUPER_MAGIC;
return 0; return 0;
} }
/* Get current cgroup from /proc/self/cgroup for the cgroupfs v2 hierarchy. */ /* Get current cgroup from /proc/self/cgroup for the cgroupfs v2 hierarchy. */