1WAIT(2)                       System Calls Manual                      WAIT(2)
2
3
4

NAME

6       wait - wait for process to terminate
7

SYNOPSIS

9       wait(status)
10       int *status;
11
12       wait(0)
13

DESCRIPTION

15       Wait  causes  its  caller to delay until a signal is received or one of
16       its child processes terminates.  If any child has died since  the  last
17       wait,  return is immediate; if there are no children, return is immedi‐
18       ate with the error bit set (resp. with a value of  -1  returned).   The
19       normal  return  yields  the process ID of the terminated child.  In the
20       case of several children several wait calls are needed to learn of  all
21       the deaths.
22
23       If  (int)status  is  nonzero,  the  high  byte  of  the word pointed to
24       receives the low byte of the argument of exit  when  the  child  termi‐
25       nated.   The  low  byte receives the termination status of the process.
26       See signal(2) for a list of termination statuses  (signals);  0  status
27       indicates  normal termination.  A special status (0177) is returned for
28       a stopped process which has not terminated and can be  restarted.   See
29       ptrace(2).   If  the  0200 bit of the termination status is set, a core
30       image of the process was produced by the system.
31
32       If the parent process terminates without waiting on its  children,  the
33       initialization process (process ID = 1) inherits the children.
34

SEE ALSO

36       exit(2), fork(2), signal(2)
37

DIAGNOSTICS

39       Returns -1 if there are no children not previously waited for.
40

ASSEMBLER

42       (wait = 7.)
43       sys wait
44       (process ID in r0)
45       (status in r1)
46
47       The  high byte of the status is the low byte of r0 in the child at ter‐
48       mination.
49
50
51
52                                                                       WAIT(2)
Impressum