]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
src/api.c: support /proc mounted with subset=pid
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Wed, 31 Aug 2022 21:03:56 +0000 (15:03 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 31 Aug 2022 21:04:05 +0000 (15:04 -0600)
commitc83cb5a2d2ff02bb42f1db4a559ccf4d432b0419
tree0f49447cafa60eb5738a5ac270a8fdb7bdfd93d9
parent16be308b037bbe11a54b692c227e160f1132eabe
src/api.c: support /proc mounted with subset=pid

/proc filesystem can be mounted with subset=pid as one of its mount
options.  This option hides all the top-level files and directories,
those are not related to processes. The cgroup v1 filesystem depends
on the /proc/cgroups to populate the cgroups controllers and will fail
during the cgroup_init() phase, when not available, whereas cgroup v2
considers this as a deprecated file and recommends reading the list of
controller from <unified mount point>/cgroup.controllers[1].

Support this valid /proc mount point only when the system is booted with
the unified mode and will fail to initialize in the case we find the
cgroup v1 mounted, i.e, the system booted with legacy or hybrid mode.

[1] https://docs.kernel.org/admin-guide/cgroup-v2.html#deprecated-v1-core-features

Fixes: https://github.com/libcgroup/libcgroup/issues/234
Reported-by: @0n-s (github username)
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
src/api.c