merge create dir and mount

This commit is contained in:
Masato Imai
2024-10-22 07:29:48 +00:00
parent 3ef40c0c4a
commit c3ab315221
2 changed files with 2 additions and 8 deletions

View File

@ -25,7 +25,7 @@ fn main() {
1, 1,
Some(CGroupOption { Some(CGroupOption {
cpu_max: Some(CpuLimit { cpu_max: Some(CpuLimit {
max: CGroupLimitValue::Value(10000), max: CGroupLimitValue::Max,
period: 100000, period: 100000,
}), }),
}), }),

View File

@ -53,13 +53,6 @@ impl IzoliBox {
None::<&str>, None::<&str>,
)?; )?;
for dir in &[
"/proc", "/dev", "/tmp", "/lib", "/usr", "/bin", "/lib64", "/usr/lib", "/usr/bin",
] {
info!("creating {}", dir);
fs::create_dir_all(format!("{}{}", root, dir))?;
}
let mounts = [ let mounts = [
("tmp", "tmpfs", MsFlags::empty()), ("tmp", "tmpfs", MsFlags::empty()),
("proc", "proc", MsFlags::empty()), ("proc", "proc", MsFlags::empty()),
@ -73,6 +66,7 @@ impl IzoliBox {
for (target, source, flags) in mounts.iter() { for (target, source, flags) in mounts.iter() {
info!("mounting {} {} {:?}", target, source, flags); info!("mounting {} {} {:?}", target, source, flags);
fs::create_dir_all(format!("{}/{}", root, target))?;
let full_target = format!("{}/{}", root, target); let full_target = format!("{}/{}", root, target);
Self::umount_mount( Self::umount_mount(
Some(source), Some(source),