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

WaitPid

Wait for a process to terminate

Declaration

Source position: oldlinux.pp line 1354

function WaitPid(

  Pid: LongInt;

  Status: pointer;

  Options: LongInt

):LongInt;

Description

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

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

The Optionsparameter can be used to specify further how WaitPidbehaves:

WNOHANG
Causes Waitpidto return immediately if no child hasexited.
WUNTRACED
Causes WaitPidto return also for children which are stopped, but whose status has not yet been reported.
__WCLONE
Causes WaitPidalso to wait for threads created by the Clonecall.

Upon return, it returns the exit status of the process, or -1 in case of failure.

For an example, see Fork.

Errors

Errors are returned in LinuxError.

See also

Fork

  

Create child process

Execve

  

Execute process using environment