sys_wait4

Function sys_wait4 

Source
pub fn sys_wait4(_abi: &mut LinuxRiscv64Abi, trapframe: &mut Trapframe) -> usize
Expand description

Wait for process to change state (wait4 system call). This is a stub implementation that returns immediately.

Arguments: Wait for process to change state (wait4 system call).

This is a Linux-compatible implementation that waits for child processes to exit and returns their process ID and exit status.

§Arguments

  • pid: process ID to wait for
    • -1: wait for any child process
    • 0: wait for specific child process

    • 0 or <-1: wait for process group (not implemented)
  • wstatus: pointer to store status information (can be null)
  • options: wait options (currently ignored - TODO: implement WNOHANG, WUNTRACED)
  • rusage: pointer to resource usage structure (can be null, currently ignored)

§Returns

  • On success: process ID of child that changed state
  • On error: negated error code (e.g., usize::MAX - 9 for -ECHILD)

§Errors

  • ECHILD: no child processes or specified child is not our child
  • EFAULT: invalid address for wstatus pointer
  • ENOSYS: unsupported operation (process groups)
  • EPERM: no current task context