The wait callable service obtains the status of a child process that has ended or stopped. You can use the wait service to obtain the status of a process that is being debugged with the ptrace facilities. The term child refers to children that are created by the fork service, as well as processes that are attached by ptrace.
Operation | Environment |
---|---|
Authorization: | Supervisor state or problem state, any PSW key |
Dispatchable unit mode: | Task |
Cross memory mode: | PASN = HASN |
AMODE (BPX1WAT): | 31-bit |
AMODE (BPX4WAT): | 64-bit |
ASC mode: | Primary mode |
Interrupt status: | Enabled for interrupts |
Locks: | Unlocked |
Control parameters: | All parameters must be addressable by the caller and in the primary address space. |
|
AMODE 64 callers use BPX4WAT with the same parameters. The Status_field_address parameter is a doubleword.
Constant | Description |
---|---|
WNOHANG | The wait service does not suspend execution of the calling process if status is not immediately available for one of the child processes that is specified by Process_ID. |
WUNTRACED | The wait service also returns the status of any child processes that are specified by Process_ID that are stopped, and whose status has not yet been reported since they stopped. If this option is not specified, the wait service returns only the status of processes that end. |
WCONTINUED | The wait service returns the status for any continued child process that is specified by Process_ID whose status has not yet been reported since it continued from a job control stop. |
The name of a fullword (doubleword) that contains the address of a fullword in which this service is to place the status value for the child process that ended or stopped. The status value can be analyzed with the status value map BPXYWAST. For a description of this mapping, see BPXYWAST — Map the wait status word. The status value is returned only if status is available for a child or debugged process, and the address specified in this field is not zero.
The name of a fullword in which the wait service returns the process ID of the child that the status information applied to, if the request is successful, or -1 if it is not successful, or 0 if WNOHANG was specified and there is at least one process whose status information is not available.
Return_code | Explanation |
---|---|
ECHILD | The caller has no appropriate child process; that is, no child process whose status has not already been obtained through earlier calls to wait meets the criteria for waiting. |
EFAULT | One of the parameters that was specified contained the address of a storage area that is not accessible to the caller. The following reason code unique to this service can accompany this return code: JRBadExitStatusAddr. |
EINTR | The calling process received a signal before the completion of an event that would cause the wait service to return. The service was interrupted by a signal. In this case, the value that is contained in Status_field_address is undefined. |
EINVAL | The value of the option is not valid. |
The name of a fullword in which the wait service stores the reason code. The wait service returns Reason_code only if Return_value is -1. Reason_code further qualifies the Return_code value. For the reason codes, see z/OS UNIX System Services Messages and Codes.
If the WUNTRACED option is specified, the foregoing also applies for stopped children and stopped debugged processes.
If status is available for one or more processes, the order in which the status is reported is unspecified.
There are no restrictions on the use of the wait service.
For an example using this callable service, see BPX1WAT (wait) example.