The wait() function shall fail if:
ECHILD
The calling process has no existing unwaited-for child
processes.
EINTR
The function was interrupted by a signal. The value of the
location pointed to by stat_loc is undefined.
The waitpid() function shall fail if:
ECHILD
The process specified by pid does not exist or is not a
child of the calling process, or the process group
specified by pid does not exist or does not have any
member process that is a child of the calling process.
EINTR
The function was interrupted by a signal. The value of the
location pointed to by stat_loc is undefined.
EINVAL
The options argument is not valid.
The following sections are informative.