Use abort() rather than unreachable! when exit fails.
This commit is contained in:
@@ -104,6 +104,7 @@ unsafe extern "C" fn fork_impl(args: &ForkArgs, initial_rsp: *mut usize) -> usiz
|
||||
}
|
||||
|
||||
unsafe extern "C" fn child_hook(cur_filetable_fd: usize, new_proc_fd: usize, new_thr_fd: usize) {
|
||||
//let _ = syscall::write(1, alloc::format!("A{cur_filetable_fd}B{new_proc_fd}C{new_thr_fd}\n").as_bytes());
|
||||
let _ = syscall::close(cur_filetable_fd);
|
||||
crate::child_hook_common(crate::ChildHookCommonArgs {
|
||||
new_thr_fd: FdGuard::new(new_thr_fd),
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#![feature(
|
||||
asm_const,
|
||||
array_chunks,
|
||||
core_intrinsics,
|
||||
int_roundings,
|
||||
let_chains,
|
||||
slice_ptr_get,
|
||||
|
||||
@@ -754,10 +754,12 @@ pub fn fork_inner(initial_rsp: *mut usize, args: &ForkArgs) -> Result<usize> {
|
||||
|
||||
// This must be done before the address space is copied.
|
||||
unsafe {
|
||||
let proc_fd = new_proc_fd.as_ref().map_or(usize::MAX, |p| **p);
|
||||
//let _ = syscall::write(1, alloc::format!("P{}Q{}R{}\n", *cur_filetable_fd, proc_fd, *new_thr_fd).as_bytes());
|
||||
initial_rsp.write(*cur_filetable_fd);
|
||||
initial_rsp
|
||||
.add(1)
|
||||
.write(new_proc_fd.as_ref().map_or(usize::MAX, |p| **p));
|
||||
.write(proc_fd);
|
||||
initial_rsp.add(2).write(*new_thr_fd);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -300,7 +300,8 @@ pub fn posix_exit(status: i32) -> ! {
|
||||
&[ProcCall::Exit as u64, status as u64],
|
||||
)
|
||||
.expect("failed to call proc mgr with Exit");
|
||||
unreachable!()
|
||||
let _ = syscall::write(1, b"redox-rt: ProcCall::Exit FAILED, abort()ing!\n");
|
||||
core::intrinsics::abort();
|
||||
}
|
||||
pub fn setrens(rns: usize, ens: usize) -> Result<()> {
|
||||
this_proc_call(
|
||||
|
||||
Reference in New Issue
Block a user