This preview shows page 1. Sign up to view the full content.
Unformatted text preview: the PID of the terminated child that caused waitpid to return, and the terminated child is removed from the system. Determining the Members of the Wait Set
The members of the wait set are determined by the pid argument: ¯ ¯ If pid > 0, then the wait set is the singleton child process whose process ID is equal to pid. If pid = -1, then the wait set consists of all of the parent’s child processes.
Aside: Waiting on sets of processes. The waitpid function also supports other kinds of wait sets, involving Unix process groups, that we will not discuss. End Aside. Modifying the Default Behavior
The default behavior can be modiﬁed by setting options to various combinations of the WNOHANG and WUNTRACED constants: ¯ ¯ ¯ WNOHANG: Return immediately (with a return value of 0) if the none of the child processes in the wait set has terminated yet. WUNTRACED: Suspend execution of the calling process until a process in the wait set becomes terminated or stopped. Return the PID of the terminated or stopped child that caused the return. WNOHANG|WUNT...
View Full Document