Compare commits

..

2 Commits

Author SHA1 Message Date
c36b14314f
mikros: Add process wait support 2024-11-08 13:37:24 -06:00
73fd453f55
mikros: Send main return value to proc_man on exit 2024-11-08 13:37:10 -06:00
2 changed files with 8 additions and 6 deletions

View File

@ -246,7 +246,11 @@ 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> {
@ -314,8 +318,7 @@ 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?;
@ -327,8 +330,7 @@ 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);
crate::sys::os::exit(code as u8);
};
}