'Linux custom init and SIGTERM
I try to build my own init with rust language.
this is my example code :
use std::process::Command;
fn main() {
loop {
println!("Welcome to custom operating system");
let result = Command::new("/bin/sh")
.spawn();
match result {
Ok(mut child) => {
let _r = child.wait();
}
Err(_err) => {
println!("Restart shell")
}
}
}
}
Note: this code work on my custom kernel without any problem.
now i have a misunderstood about init and SIGTERM signal .
should i implement trap SIGTERM on my init or kernel handle it ?
I read man 2 kill but still i have confused .
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|