home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / utilities / utilss / sockets / include / sys / h / wait < prev   
Encoding:
Text File  |  1995-01-11  |  2.8 KB  |  84 lines

  1. /*
  2.  * $Header: /ax/networking:include/sys/wait.h:networking  1.1  $
  3.  * $Source: /ax/networking:include/sys/wait.h: $
  4.  *
  5.  * Copyright (c) 1988 Acorn Computers Ltd., Cambridge, England
  6.  *
  7.  * $Log:    wait.h,v $
  8.  * Revision 1.1  95/01/11  10:20:12  kwelton
  9.  * Initial revision
  10.  * 
  11.  * Revision 1.3  88/06/17  20:23:21  beta
  12.  * Acorn Unix initial beta version
  13.  * 
  14.  */
  15. /* @(#)wait.h    1.2 87/05/15 3.2/4.3NFSSRC */
  16. /*
  17.  * Copyright (c) 1982, 1986 Regents of the University of California.
  18.  * All rights reserved.  The Berkeley software License Agreement
  19.  * specifies the terms and conditions for redistribution.
  20.  *
  21.  *    @(#)wait.h    7.1 (Berkeley) 6/4/86
  22.  */
  23.  
  24. /*
  25.  * This file holds definitions relevent to the wait system call.
  26.  * Some of the options here are available only through the ``wait3''
  27.  * entry point; the old entry point with one argument has more fixed
  28.  * semantics, never returning status of unstopped children, hanging until
  29.  * a process terminates if any are outstanding, and never returns
  30.  * detailed information about process resource utilization (<vtimes.h>).
  31.  */
  32.  
  33. /*
  34.  * Structure of the information in the first word returned by both
  35.  * wait and wait3.  If w_stopval==WSTOPPED, then the second structure
  36.  * describes the information returned, else the first.  See WUNTRACED below.
  37.  */
  38. union wait    {
  39.     int    w_status;        /* used in syscall */
  40.     /*
  41.      * Terminated process status.
  42.      */
  43.     struct {
  44.         unsigned short    w_Termsig:7;    /* termination signal */
  45.         unsigned short    w_Coredump:1;    /* core dump indicator */
  46.         unsigned short    w_Retcode:8;    /* exit code if w_termsig==0 */
  47.     } w_T;
  48.     /*
  49.      * Stopped process status.  Returned
  50.      * only for traced children unless requested
  51.      * with the WUNTRACED option bit.
  52.      */
  53.     struct {
  54.         unsigned short    w_Stopval:8;    /* == W_STOPPED if stopped */
  55.         unsigned short    w_Stopsig:8;    /* signal that stopped us */
  56.     } w_S;
  57. };
  58. #define    w_termsig    w_T.w_Termsig
  59. #define w_coredump    w_T.w_Coredump
  60. #define w_retcode    w_T.w_Retcode
  61. #define w_stopval    w_S.w_Stopval
  62. #define w_stopsig    w_S.w_Stopsig
  63.  
  64.  
  65. #define    WSTOPPED    0177    /* value of s.stopval if process is stopped */
  66.  
  67. /*
  68.  * Option bits for the second argument of wait3.  WNOHANG causes the
  69.  * wait to not hang if there are no stopped or terminated processes, rather
  70.  * returning an error indication in this case (pid==0).  WUNTRACED
  71.  * indicates that the caller should receive status about untraced children
  72.  * which stop due to signals.  If children are stopped and a wait without
  73.  * this option is done, it is as though they were still running... nothing
  74.  * about them is returned.
  75.  */
  76. #define WNOHANG        1    /* dont hang in wait */
  77. #define WUNTRACED    2    /* tell about stopped, untraced children */
  78.  
  79. #define WIFSTOPPED(x)    ((x).w_stopval == WSTOPPED)
  80. #define WIFSIGNALED(x)    ((x).w_stopval != WSTOPPED && (x).w_termsig != 0)
  81. #define WIFEXITED(x)    ((x).w_stopval != WSTOPPED && (x).w_termsig == 0)
  82.  
  83. /* EOF wait.h */
  84.