This preview shows page 1. Sign up to view the full content.
Unformatted text preview: the signal that caused the child process to terminate. This status is only deﬁned if WIFSIGNALED(status) returned true. WIFSTOPPED(status): Returns true if the child that caused the return is currently stopped. WSTOPSIG(status): Returns the number of the signal that caused the child to stop. This status is only deﬁned if WIFSTOPPED(status) returned true. Error Conditions
If the calling process has no children, then waitpid returns ½ and sets errno to ECHILD. If the waitpid function was interrupted by a signal, then it returns ½ and sets errno to EINTR.
Aside: Constants associated with Unix functions. Constants such as WNOHANG and WUNTRACED are deﬁned by system header ﬁles. For example, WNOHANG and WUNTRACED are deﬁned (indirectly) by the wait.h header ﬁle: /* Bits in the third argument to ‘waitpid’. */ #define WNOHANG 1 /* Don’t block waiting. */ #define WUNTRACED 2 /* Report status of stopped children. */
In order to use these constants, you must include the wait.h header ﬁle in your code: #include <sys/wait.h>
The man page for each Uni...
View Full Document