]> 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:08:04 +0000 (15:08 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 31 Aug 2022 21:08:26 +0000 (15:08 -0600)
commitd7cd75e24c277b30a09c5f7950fd154424f1484b
tree52bbbadd9ad1cbb1a5e710a37cf69f4d71066c9b
parent1686eb6f24b3f9f37e1393bd5139206dfd5e5259
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>
(cherry picked from commit c83cb5a2d2ff02bb42f1db4a559ccf4d432b0419)
src/api.c