cgroup: collect path of cgroup when running a container in a container

Path of cgroup is wrong when running a container in a container. Use
the root path of mountinfo fetched from /proc/$(shim_pid)/mountinfo
to trim the path obtained from /proc/self/mountinfo.

Fixes: #131

Signed-off-by: 乔琛 10307740 <qiao.chen@zte.com.cn>
This commit is contained in:
乔琛 10307740
2024-01-08 20:21:26 +08:00
parent 69ef63a0ef
commit 4005ad844d
17 changed files with 147 additions and 82 deletions
+3 -3
View File
@@ -540,10 +540,10 @@ impl ControllerInternal for MemController {
impl MemController {
/// Contructs a new `MemController` with `root` serving as the root of the control group.
pub fn new(root: PathBuf, v2: bool) -> Self {
pub fn new(point: PathBuf, root: PathBuf, v2: bool) -> Self {
Self {
base: root.clone(),
path: root,
base: root,
path: point,
v2,
}
}