Compare commits

..

2 Commits

Author SHA1 Message Date
201eaf576a
mikros: Add process wait support 2024-11-08 13:39:13 -06:00
8fa25a4322
mikros: Send main return value to proc_man on exit 2024-11-08 13:38:10 -06:00
2 changed files with 6 additions and 8 deletions

View File

@ -246,11 +246,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
impl ExitStatus {
pub fn exit_ok(&self) -> Result<(), ExitStatusError> {
if self.0 == 0 {
Ok(())
} else {
Err(ExitStatusError(self.0))
}
if self.0 == 0 { Ok(()) } else { Err(ExitStatusError(self.0)) }
}
pub fn code(&self) -> Option<i32> {
@ -318,7 +314,8 @@ pub fn wait(&mut self) -> io::Result<ExitStatus> {
return unsupported();
};
let wait_res: Result<(u64, u8), Errno> = postcard::from_bytes(
&rpc::send_call(proc_man_pid, 8, 5, &postcard::to_allocvec(&(self.pid, true)).unwrap()).get_return(),
&rpc::send_call(proc_man_pid, 8, 5, &postcard::to_allocvec(&(self.pid, true)).unwrap())
.get_return(),
)
.unwrap();
let (_wait_pid, code) = wait_res?;
@ -330,7 +327,8 @@ pub fn try_wait(&mut self) -> io::Result<Option<ExitStatus>> {
return unsupported();
};
let wait_res: Result<(u64, u8), Errno> = postcard::from_bytes(
&rpc::send_call(proc_man_pid, 8, 5, &postcard::to_allocvec(&(self.pid, true)).unwrap()).get_return(),
&rpc::send_call(proc_man_pid, 8, 5, &postcard::to_allocvec(&(self.pid, true)).unwrap())
.get_return(),
)
.unwrap();
let (_wait_pid, code) = match wait_res {

View File

@ -13,6 +13,6 @@ pub extern "C" fn _start() {
unsafe {
asm!("int 0x80", in("rax") 19, lateout("rax") argv, lateout("rcx") argc);
let code = main(argc, argv);
crate::sys::os::exit(code as u8);
crate::sys::os::exit(code);
};
}