mirror of
https://github.com/mii443/izoli.git
synced 2025-08-22 16:05:40 +00:00
auto prelude
This commit is contained in:
@ -40,9 +40,6 @@ fn main() {
|
|||||||
|
|
||||||
let pid = izolibox
|
let pid = izolibox
|
||||||
.enter(Box::new(|| {
|
.enter(Box::new(|| {
|
||||||
IzoliBox::prelude(1).unwrap();
|
|
||||||
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![];
|
||||||
if let Err(e) = execvp(&cmd, &args.as_ref()) {
|
if let Err(e) = execvp(&cmd, &args.as_ref()) {
|
||||||
|
@ -46,7 +46,16 @@ impl IzoliBox {
|
|||||||
cgroup.enter().unwrap();
|
cgroup.enter().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe { sched::clone(callback, &mut stack, flags, Some(SIGCHLD)) }
|
let mut callback = callback;
|
||||||
|
let new_callback = Box::new(|| {
|
||||||
|
IzoliBox::prelude(self.id).unwrap();
|
||||||
|
|
||||||
|
callback();
|
||||||
|
|
||||||
|
127
|
||||||
|
});
|
||||||
|
|
||||||
|
unsafe { sched::clone(new_callback, &mut stack, flags, Some(SIGCHLD)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn prelude(id: usize) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn prelude(id: usize) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
Reference in New Issue
Block a user