diff --git a/redox-rt/src/arch/i686.rs b/redox-rt/src/arch/i686.rs index 681f1a9e65d439c9acf913df7867e71a96980aa5..be0d92406cdfdbc690abe9e1b24e43d4eb813c63 100644 --- a/redox-rt/src/arch/i686.rs +++ b/redox-rt/src/arch/i686.rs @@ -5,6 +5,7 @@ use syscall::*; use crate::{ proc::{fork_inner, FdGuard}, signal::{inner_fastcall, RtSigarea, SigStack, PROC_CONTROL_STRUCT}, + RtTcb, }; // Setup a stack starting from the very end of the address space, and then growing downwards. @@ -80,7 +81,11 @@ unsafe extern "cdecl" fn fork_impl(initial_rsp: *mut usize) -> usize { unsafe extern "cdecl" fn child_hook(cur_filetable_fd: usize, new_pid_fd: usize) { let _ = syscall::close(cur_filetable_fd); - let _ = syscall::close(new_pid_fd); + // TODO: Currently pidfd == threadfd, but this will not be the case later. + RtTcb::current() + .thr_fd + .get() + .write(Some(FdGuard::new(new_pid_fd))); } asmfunction!(__relibc_internal_fork_wrapper -> usize: [" diff --git a/redox-rt/src/arch/x86_64.rs b/redox-rt/src/arch/x86_64.rs index 07af525409f3384b565eb5a5f5ab022afb242e08..d0d0f9bf047014161ba7137b3b0b460822f7d974 100644 --- a/redox-rt/src/arch/x86_64.rs +++ b/redox-rt/src/arch/x86_64.rs @@ -91,7 +91,7 @@ unsafe extern "sysv64" fn fork_impl(initial_rsp: *mut usize) -> usize { unsafe extern "sysv64" fn child_hook(cur_filetable_fd: usize, new_pid_fd: usize) { let _ = syscall::close(cur_filetable_fd); - // TODO: Currently equivalent, but this will not be the case later. + // TODO: Currently pidfd == threadfd, but this will not be the case later. RtTcb::current() .thr_fd .get() diff --git a/redox-rt/src/signal.rs b/redox-rt/src/signal.rs index dcc0592a0f2dc5fc572dd18707a6570302b580f7..00bd3474c0cb4843da5ee7184dc54bd460c7f5a9 100644 --- a/redox-rt/src/signal.rs +++ b/redox-rt/src/signal.rs @@ -481,7 +481,7 @@ pub fn setup_sighandler(tcb: &RtTcb) { arch.altstack_top = usize::MAX; arch.altstack_bottom = 0; // TODO - #[cfg(any(target_arch = "i686", target_arch = "aarch64"))] + #[cfg(any(target_arch = "x86", target_arch = "aarch64"))] { arch.pctl = core::ptr::addr_of!(PROC_CONTROL_STRUCT) as usize; }