z/OS Using REXX and z/OS UNIX System Services
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


wait

z/OS Using REXX and z/OS UNIX System Services
SA23-2283-00

Read syntax diagramSkip visual syntax diagram
>>-wait--stem--------------------------------------------------><

Function

wait invokes the wait callable service to obtain the status of any 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 a child process created by a fork as well as a process attached by ptrace.

Parameters

stem
The name of a stem variable used to return the information. Upon return, stem.0 contains the number of variables returned. To access the information in the stem variables, you can specify a numeric value (see REXX predefined variables) or the predefined variables beginning with W_ that derive the appropriate numeric value.
Variable Description
W_CONTINUED Process continued from stop
W_EXITSTATUS The exit status of the child process
W_IFEXITED The child process ended normally
W_IFSIGNALED The child process ended because of a signal that was not caught
W_IFSTOPPED Wait if the child process is stopped
W_STAT3 Byte 3 of the BPXYWAST macro. See BPXYWAST — Map the Wait Status Word in z/OS UNIX System Services Programming: Assembler Callable Services Reference.
W_STAT4 Byte 4 of the BPXYWAST macro. See BPXYWAST — Map the Wait Status Word in z/OS UNIX System Services Programming: Assembler Callable Services Reference.
W_STOPSIG The signal number that caused the child process to stop
W_TERMSIG The signal number that caused the child process to end

Usage notes

  1. The wait service suspends execution of the calling thread until one of the requested child or debugged processes ends or until it obtains information about the process that ended. If a child or debugged process has already ended but its status has not been reported when wait is called, the routine immediately returns with that status information to the caller.
  2. If the WUNTRACED option is specified, the foregoing also applies for stopped children or stopped debugged processes.
  3. The wait service always returns status for stopped debugged processes, even if WUNTRACED is not specified.
  4. If status is available for one or more processes, the order in which the status is reported is unspecified.
Note: A debugged process is one that is being monitored for debugging purposes with the ptrace service.

Example

See Set up a signal to enforce a time limit for a program for an example of signal coding that interprets the stem this returns:
"wait wstat."

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014