Skip to main content

os/syscall/
process.rs

1//! Process management syscalls
2use crate::task::{exit_current_and_run_next, suspend_current_and_run_next};
3
4/// task exits and submit an exit code
5pub fn sys_exit(exit_code: i32) -> ! {
6    println!("[kernel] Application exited with code {}", exit_code);
7    exit_current_and_run_next();
8    panic!("Unreachable in sys_exit!");
9}
10
11/// current task gives up resources for other tasks
12pub fn sys_yield() -> isize {
13    suspend_current_and_run_next();
14    0
15}