cgroups: add unified_cgroup_fd() helper

parent 3c5fa7f3
......@@ -98,3 +98,16 @@ int unified_cgroup_hierarchy(void)
return 0;
}
int unified_cgroup_fd(int fd)
{
int ret;
struct statfs fs;
ret = fstatfs(fd, &fs);
if (!ret && is_fs_type(&fs, CGROUP2_SUPER_MAGIC))
return true;
return false;
}
......@@ -30,4 +30,6 @@ __hidden extern bool test_writeable_v2(char *mountpoint, char *path);
__hidden extern int unified_cgroup_hierarchy(void);
__hidden extern int unified_cgroup_fd(int fd);
#endif /* __LXC_CGROUP_UTILS_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment