return value of wait() and waitpid()

RETURN VALUE
The process ID of the child which exited, or zero if WNOHANG was used and no child was available, or -1 on error (in which case errno is set to an appropriate value). 
ERRORS

ECHILD
    if the process specified in pid does not exist or is not a child of the calling process. (This can happen for one's own child if the action for SIGCHLD is set to SIG_IGN. See also the LINUX NOTES section about threads.)
EINVAL
    if the options argument was invalid.
EINTR
    if WNOHANG was not set and an unblocked signal or a SIGCHLD was caught.

猜你喜欢

转载自wwwjjq.iteye.com/blog/1625984