next up previous contents index
Next: The MMX unit Up: Functions and procedures Previous: Utime

WaitPid

   

Declaration:

Function WaitPid (Pid : longint; Status : pointer; Options : Integer) : Longint;

Description:

WaitPid waits for a child process with process ID Pid to exit. The value of Pid can be one of the following:

Pid < -1
Causes WaitPid to wait for any child process whose process group ID equals the absolute value of pid.

Pid = -1
Causes WaitPid to wait for any child process.

Pid = 0
Causes WaitPid to wait for any child process whose process group ID equals the one of the calling process.

Pid > 0
Causes WaitPid to wait for the child whose process ID equals the value of Pid.

The Options parameter can be used to specify further how WaitPid behaves:
WNOHANG
Causes Waitpid to return immediately if no child has exited.
WUNTRACED
Causes WaitPid to return also for children which are stopped, but whose status has not yet been reported.

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

Errors:

Errors are returned in LinuxError.

See also:

Fork, Execve, waitpid (2)

for an example, see Fork.



Michael Van Canneyt
Thu Sep 10 13:59:33 CEST 1998