feature: basic signal handling

This commit is contained in:
2021-11-11 13:46:36 +02:00
parent dacbea02d6
commit afc6ccc8dd
11 changed files with 261 additions and 18 deletions
+10
View File
@@ -4,6 +4,8 @@
#[macro_use]
extern crate libusr;
use libusr::sys::Signal;
fn readline(fd: i32, buf: &mut [u8]) -> Result<&str, ()> {
let count = unsafe { libusr::sys::sys_read(fd, buf) };
if count >= 0 {
@@ -26,6 +28,14 @@ fn main() -> i32 {
println!(":: {:?}", line);
if line == "test" {
unsafe {
libusr::sys::sys_ex_kill(0, Signal::Interrupt);
}
trace!("Returned from signal");
continue;
}
if line == "quit" || line == "exit" {
break;
}