home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / man / cat2 / wait.0 < prev    next >
Text File  |  1993-12-07  |  8KB  |  199 lines

  1.  
  2. WAIT(2)                    UNIX Programmer's Manual                    WAIT(2)
  3.  
  4. NNAAMMEE
  5.      wwaaiitt, wwaaiittppiidd, wwaaiitt44, wwaaiitt33 - wait for process terminatation
  6.  
  7. SSYYNNOOPPSSIISS
  8.      ##iinncclluuddee <<ssyyss//ttyyppeess..hh>>
  9.      ##iinncclluuddee <<ssyyss//wwaaiitt..hh>>
  10.  
  11.      _p_i_d___t
  12.      wwaaiitt(_i_n_t _*_s_t_a_t_u_s)
  13.  
  14.      ##iinncclluuddee <<ssyyss//ttiimmee..hh>>
  15.      ##iinncclluuddee <<ssyyss//rreessoouurrccee..hh>>
  16.  
  17.      _p_i_d___t
  18.      wwaaiittppiidd(_p_i_d___t _w_p_i_d, _i_n_t _*_s_t_a_t_u_s, _i_n_t _o_p_t_i_o_n_s)
  19.  
  20.      _p_i_d___t
  21.      wwaaiitt33(_i_n_t _*_s_t_a_t_u_s, _i_n_t _o_p_t_i_o_n_s, _s_t_r_u_c_t _r_u_s_a_g_e _*_r_u_s_a_g_e)
  22.  
  23.      _p_i_d___t
  24.      wwaaiitt44(_p_i_d___t _w_p_i_d, _i_n_t _*_s_t_a_t_u_s, _i_n_t _o_p_t_i_o_n_s, _s_t_r_u_c_t _r_u_s_a_g_e _*_r_u_s_a_g_e)
  25.  
  26. DDEESSCCRRIIPPTTIIOONN
  27.      The wwaaiitt() function suspends execution of its calling process until
  28.      _s_t_a_t_u_s information is available for a terminated child process, or a sig­
  29.      nal is received.  On return from a successful wwaaiitt() call, the _s_t_a_t_u_s
  30.      area contains termination information about the process that exited as
  31.      defined below.
  32.  
  33.      The wwaaiitt44() call provides a more general interface for programs that need
  34.      to wait for certain child processes, that need resource utilization
  35.      statistics accummulated by child processes, or that require options.  The
  36.      other wait functions are implemented using wwaaiitt44().
  37.  
  38.      The _w_p_i_d parameter specifies the set of child processes for which to
  39.      wait.  If _w_p_i_d is ­1, the call waits for any child process.  If _w_p_i_d is
  40.      0, the call waits for any child process in the process group of the
  41.      caller.  If _w_p_i_d is greater than zero, the call waits for the process
  42.      with process id _w_p_i_d. If _w_p_i_d is less than ­1, the call waits for any
  43.      process whose process group id equals the absolute value of _w_p_i_d.
  44.  
  45.      The _s_t_a_t_u_s parameter is defined below.  The _o_p_t_i_o_n_s parameter contains
  46.      the bitwise OR of any of the following options.  The WNOHANG option is
  47.      used to indicate that the call should not block if there are no processes
  48.      that wish to report status.  If the WUNTRACED option is set, children of
  49.      the current process that are stopped due to a SIGTTIN, SIGTTOU, SIGTSTP,
  50.      or SIGSTOP signal also have their status reported.
  51.  
  52.      If _r_u_s_a_g_e is non­zero, a summary of the resources used by the terminated
  53.      process and all its children is returned (this information is currently
  54.      not available for stopped processes).
  55.  
  56.      When the WNOHANG option is specified and no processes wish to report sta­
  57.      tus, wwaaiitt44() returns a process id of 0.
  58.  
  59.      The wwaaiittppiidd() call is identical to wwaaiitt44() with an _r_u_s_a_g_e value of zero.
  60.      The older wwaaiitt33() call is the same as wwaaiitt44() with a _w_p_i_d value of ­1.
  61.  
  62.      The following macros may be used to test the manner of exit of the pro­
  63.      cess.  One of the first three macros will evaluate to a non­zero (true)
  64.  
  65.  
  66.      value:
  67.  
  68.      WWIIFFEEXXIITTEEDD(_s_t_a_t_u_s)
  69.              True if the process terminated normally by a call to _exit(2) or
  70.              exit(2).
  71.  
  72.      WWIIFFSSIIGGNNAALLEEDD(_s_t_a_t_u_s)
  73.              True if the process terminated due to receipt of a signal.
  74.  
  75.      WWIIFFSSTTOOPPPPEEDD(_s_t_a_t_u_s)
  76.              True if the process has not terminated, but has stopped and can
  77.              be restarted.  This macro can be true only if the wait call spec­
  78.              ified the WUNTRACED option or if the child process is being
  79.              traced (see ptrace(2)).
  80.  
  81.      Depending on the values of those macros, the following macros produce the
  82.      remaining status information about the child process:
  83.  
  84.      WWEEXXIITTSSTTAATTUUSS(_s_t_a_t_u_s)
  85.              If WWIIFFEEXXIITTEEDD(_s_t_a_t_u_s) is true, evaluates to the low­order 8 bits
  86.              of the argument passed to _exit(2) or exit(2) by the child.
  87.  
  88.      WWTTEERRMMSSIIGG(_s_t_a_t_u_s)
  89.              If WWIIFFSSIIGGNNAALLEEDD(_s_t_a_t_u_s) is true, evaluates to the number of the
  90.              signal that caused the termination of the process.
  91.  
  92.      WWCCOORREEDDUUMMPP(_s_t_a_t_u_s)
  93.              If WWIIFFSSIIGGNNAALLEEDD(_s_t_a_t_u_s) is true, evaluates as true if the termina­
  94.              tion of the process was accompanied by the creation of a core
  95.              file containing an image of the process when the signal was re­
  96.              ceived.
  97.  
  98.      WWSSTTOOPPSSIIGG(_s_t_a_t_u_s)
  99.              If WWIIFFSSTTOOPPPPEEDD(_s_t_a_t_u_s) is true, evaluates to the number of the
  100.              signal that caused the process to stop.
  101.  
  102. NNOOTTEESS
  103.      See sigaction(2) for a list of termination signals.  A status of 0 indi­
  104.      cates normal termination.
  105.  
  106.      If a parent process terminates without waiting for all of its child pro­
  107.      cesses to terminate, the remaining child processes are assigned the par­
  108.      ent process 1 ID (the init process ID).
  109.  
  110.      If a signal is caught while any of the wwaaiitt() calls is pending, the call
  111.      may be interrupted or restarted when the signal­catching routine returns,
  112.      depending on the options in effect for the signal; see intro(2),  System
  113.      call restart.
  114.  
  115. RREETTUURRNN VVAALLUUEESS
  116.      If wwaaiitt() returns due to a stopped or terminated child process, the pro­
  117.      cess ID of the child is returned to the calling process.  Otherwise, a
  118.      value of ­1 is returned and _e_r_r_n_o is set to indicate the error.
  119.  
  120.      If wwaaiitt44(), wwaaiitt33() or wwaaiittppiidd() returns due to a stopped or terminated
  121.      child process, the process ID of the child is returned to the calling
  122.      process.  If there are no children not previously awaited, ­1 is returned
  123.      with _e_r_r_n_o set to [ECHILD]. Otherwise, if WNOHANG is specified and there
  124.      are no stopped or exited children, 0 is returned.  If an error is detect­
  125.      ed or a caught signal aborts the call, a value of ­1 is returned and
  126.      _e_r_r_n_o is set to indicate the error.
  127.  
  128. EERRRROORRSS
  129.      WWaaiitt() will fail and return immediately if:
  130.  
  131.      [ECHILD]      The calling process has no existing unwaited­for child pro­
  132.  
  133.                    cesses.
  134.  
  135.      [EFAULT]      The _s_t_a_t_u_s or _r_u_s_a_g_e arguments point to an illegal address.
  136.                    (May not be detected before exit of a child process.)
  137.  
  138.      [EINTR]       The call was interrupted by a caught signal, or the signal
  139.                    did not have the SA_RESTART flag set.
  140.  
  141. SSTTAANNDDAARRDDSS
  142.      The wwaaiitt() and wwaaiittppiidd() functions are defined by POSIX; wwaaiitt44() and
  143.      wwaaiitt33() are not specified by POSIX.  The WWCCOORREEDDUUMMPP() macro and the abili­
  144.      ty to restart a pending wwaaiitt() call are extensions to the POSIX inter­
  145.      face.
  146.  
  147. SSEEEE AALLSSOO
  148.      exit(2),  sigaction(2)
  149.  
  150. HHIISSTTOORRYY
  151.      A wwaaiitt function call appeared in Version 6 AT&T UNIX.
  152.  
  153. 4th Berkeley Distribution       March 10, 1991                               3
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.