pub fn add_v2_mounts(&mut self) -> std::result::Result<(), std::io::Error> {
            writeln!(
                self.mounts_file,
                "cgroupv2 {}/unified cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate 0 0",
                Self::MOCK_SYS_CGROUPS_DIR
            )?;
            let cg_unified_path = PathBuf::from(format!("{}/unified", Self::MOCK_SYS_CGROUPS_DIR));
            let _ = fs::create_dir_all(&cg_unified_path)?;
            Self::create_file_with_contents(
                cg_unified_path.join("cgroup.controllers"),
                "cpuset cpu io memory pids",
            )?;
            Self::create_file_with_contents(cg_unified_path.join("cgroup.subtree_control"), "")?;
            Ok(())
        }
// Populate the mocked proc/mounts file with cgroupv2 entries
// Also create a directory structure that simulates cgroupsv2 layout
Populate the mocked proc/mounts file with cgroupv2 entries
Also create a directory structure that simulates cgroupsv2 layout
Populate the mocked proc / mounts file with cgroupv2 entries Also create a directory structure that simulates cgroupsv2 layout
pub fn add_v2_mounts(&mut self) -> std::result::Result<(), std::io::Error> {
            writeln!(
                self.mounts_file,
                "cgroupv2 {}/unified cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate 0 0",
                Self::MOCK_SYS_CGROUPS_DIR
            )?;
            let cg_unified_path = PathBuf::from(format!("{}/unified", Self::MOCK_SYS_CGROUPS_DIR));
            let _ = fs::create_dir_all(&cg_unified_path)?;
            Self::create_file_with_contents(
                cg_unified_path.join("cgroup.controllers"),
                "cpuset cpu io memory pids",
            )?;
            Self::create_file_with_contents(cg_unified_path.join("cgroup.subtree_control"), "")?;
            Ok(())
        }
pub fn add_v2_mounts ( & mut self ) -> std :: result :: Result < ( ) , std :: io :: Error > { writeln ! ( self mounts_file " " Self MOCK_SYS_CGROUPS_DIR ) ? ; let cg_unified_path = PathBuf :: from ( format ! ( " " Self MOCK_SYS_CGROUPS_DIR ) ) ; let _ = fs :: create_dir_all ( & cg_unified_path ) ? ; Self :: create_file_with_contents ( cg_unified_path . join ( " " ) , " " , ) ? ; Self :: create_file_with_contents ( cg_unified_path . join ( " " ) , " " ) ? ; Ok ( ( ) ) }
Populate the mocked proc/mounts file with cgroupv2 entries
Also create a directory structure that simulates cgroupsv2 layout
Populate the mocked proc / mounts file with cgroupv2 entries Also create a directory structure that simulates cgroupsv2 layout
&mut self
&mut self