wait(3)

DESCRIPTION

Waits for and reaps any child process, using the same status encoding as waitpid.

SYNOPSIS

#include <sys/wait.h>

int wait(int *status);

RETURN VALUE

  • Returns the child PID, or -1 and sets errno.

ERRORS

  • -EFAULT
    • Status is non‑null but not writable.
  • -ECHILD
    • The caller has no children.

NOTES

This is equivalent to waitpid(-1, status, 0).