The shell catches the signal see section 853 and then

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: the signal that caused the child process to terminate. This status is only defined 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 defined 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 defined by system header files. For example, WNOHANG and WUNTRACED are defined (indirectly) by the wait.h header file: /* 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 file in your code: #include <sys/wait.h> The man page for each Uni...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online