pub fn sys_waitpid(
pid: i64,
status_ptr: u64,
options: u32,
) -> Result<u64, SyscallError>Expand description
SYS_PROC_WAITPID (310): wait for a child process to exit.
Arguments:
pid: child task ID to wait for, or-1(any child).status_ptr: userspace*i32to receive the encoded wait status (W_EXITCODE). Pass0to discard.options:WNOHANG (1)— return immediately if no child ready.
Returns:
- child task ID on success.
0ifWNOHANGand no child has exited yet.
Errors:
-ECHILD (-10)— no matching children.-EINTR (-4)— interrupted by a pending signal.-EINVAL (-22)— unknown option bits.