mirror of
https://github.com/mii443/izoli.git
synced 2025-08-22 16:05:40 +00:00
wip
This commit is contained in:
@ -1,13 +1,10 @@
|
|||||||
use std::{ffi::CString, process::Command};
|
use std::ffi::CString;
|
||||||
|
|
||||||
use izolilib::{
|
use izolilib::{
|
||||||
cgroup::{cgroup::CGroup, cgroup_option::CGroupOption, cpu_limit::CpuLimit},
|
cgroup::{cgroup::CGroup, cgroup_option::CGroupOption, cpu_limit::CpuLimit},
|
||||||
izolibox::IzoliBox,
|
izolibox::IzoliBox,
|
||||||
};
|
};
|
||||||
use nix::{
|
use nix::{sys::wait::waitpid, unistd::execvp};
|
||||||
sys::wait::waitpid,
|
|
||||||
unistd::{execvp, sethostname},
|
|
||||||
};
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let cgroup = CGroup::new("izoli").unwrap();
|
let cgroup = CGroup::new("izoli").unwrap();
|
||||||
@ -31,10 +28,7 @@ fn main() {
|
|||||||
println!("Isolated process: {}", std::process::id());
|
println!("Isolated process: {}", std::process::id());
|
||||||
|
|
||||||
let cmd = CString::new("/usr/bin/bash").unwrap();
|
let cmd = CString::new("/usr/bin/bash").unwrap();
|
||||||
let args: Vec<CString> = vec![
|
let args: Vec<CString> = vec![];
|
||||||
//CString::new("containered bash").unwrap(),
|
|
||||||
//CString::new("-l").unwrap(),
|
|
||||||
];
|
|
||||||
if let Err(e) = execvp(&cmd, &args.as_ref()) {
|
if let Err(e) = execvp(&cmd, &args.as_ref()) {
|
||||||
eprintln!("execvp failed: {:?}", e);
|
eprintln!("execvp failed: {:?}", e);
|
||||||
return 127;
|
return 127;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
use std::{env::set_current_dir, fs, os::unix::fs::chroot, path::Path};
|
use std::{env::set_current_dir, fs, os::unix::fs::chroot, path::Path};
|
||||||
|
|
||||||
use nix::{
|
use nix::{
|
||||||
errno::Errno,
|
|
||||||
libc::SIGCHLD,
|
libc::SIGCHLD,
|
||||||
mount::{mount, umount, MsFlags},
|
mount::{mount, umount, MsFlags},
|
||||||
sched::{self, CloneCb, CloneFlags},
|
sched::{self, CloneCb, CloneFlags},
|
||||||
|
Reference in New Issue
Block a user