Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

PXFWAITPID

POSIX Subroutine: Waits for a specific PID. This routine is only available for Linux.

Module

USE IFPOSIX

CALL PXFWAITPID (ipid,istat,ioptions,iretpid,ierror)

ipid

(Input) INTEGER(4). The PID to wait for. One of the following values:

Value

Action

< -1

Specifies to wait for any child process whose process group ID is equal to the absolute value of ipid.

-1

Specifies to wait for any child process; this is the same behavior as PXFWAIT.

0

Specifies to wait for any child process whose process group ID is equal to that of the calling process.

> 0

Specifies to wait for the child whose process ID is equal to the value of ipid.

istat

(Output) INTEGER(4). The returned status of the child process.

ioptions

(Input) INTEGER(4). One or more of the following constant values (which can be passed to PXFCONST or IPXFCONST):

Value

Action

WNOHANG

Specifies to return immediately if no child process has exited.

WUNTRACED

Specifies to return for child processes that have stopped, and whose status has not been reported.

iretpid

(Output) INTEGER(4). The PID of the stopped child process.

ierror

(Output) INTEGER(4). The error status.

If successful, ierror is set to zero; otherwise, an error code.

The PXFWAITPID subroutine suspends execution of the current process until the child specified by ipid has exited, or until a signal is delivered whose action terminates the current process or calls a signal handling routine. If the child specified by ipid has already exited by the time of the call (a "zombie" process), a return is immediately made. Any system resources used by the child are freed.

The returned value in istat can be used in subroutines IPXFWEXITSTATUS, IPXFWSTOPSIG, IPXFWTERMSIG, PXFWIFEXITED, PXFWIFSIGNALLED, and PXFWIFSTOPPED.