[Overview][Constants][Types][Procedures and functions] Reference for unit 'BaseUnix' (#rtl)

FpWaitPid

Wait for a process to terminate

Declaration

Source position: line 0

function FpWaitpid(

  pid: TPid;

  stat_loc: pcInt;

  options: cInt

):TPid;

function FpWaitPid(

  pid: TPid;

  var Status: cInt;

  Options: cInt

):TPid;

Description

fpWaitPidwaits for a child process with process ID Pidto exit. The value of Pidcan be one of the following:

Pid <-1
Causes fpWaitPidto wait for any child process whose process group ID equals the absolute value of pid.
Pid = -1
Causes fpWaitPidto wait for any child process.
Pid = 0
Causes fpWaitPidto wait for any child process whose process group ID equals the one of the calling process.
Pid >0
Causes fpWaitPidto wait for the child whose process ID equals the value of Pid.

The Optionsparameter can be used to specify further how fpWaitPidbehaves:

WNOHANG
Causes fpWaitpidto return immediately if no child hasexited.
WUNTRACED
Causes fpWaitPidto return also for children which are stopped, but whose status has not yet been reported.
__WCLONE
Causes fpWaitPidalso to wait for threads created by the #rtl.linux.Clonecall.

The exit status of the process that caused fpWaitPIDis reported in stat_locor Status.

Upon return, it returns the process id of the process that exited, 0 if no process exited, or -1 in case of failure.

For an example, see fpFork.

Errors

Extended error information can be retrieved using fpgetErrno.

See also

fpFork

  

Create child process

fpExecve

  

Execute process using environment

fpWait

  

Wait for a child to exit.