home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume25 / tcsh-6.01 / part03 / tc.wait.h < prev    next >
C/C++ Source or Header  |  1991-12-19  |  5KB  |  153 lines

  1. /* $Header: /home/hyperion/mu/christos/src/sys/tcsh-6.01/RCS/tc.wait.h,v 3.3 1991/11/26 04:28:26 christos Exp $ */
  2. /*
  3.  * tc.wait.h: <sys/wait.h> for machines that don't have it or have it and
  4.  *          is incorrect.
  5.  */
  6. /*-
  7.  * Copyright (c) 1980, 1991 The Regents of the University of California.
  8.  * All rights reserved.
  9.  *
  10.  * Redistribution and use in source and binary forms, with or without
  11.  * modification, are permitted provided that the following conditions
  12.  * are met:
  13.  * 1. Redistributions of source code must retain the above copyright
  14.  *    notice, this list of conditions and the following disclaimer.
  15.  * 2. Redistributions in binary form must reproduce the above copyright
  16.  *    notice, this list of conditions and the following disclaimer in the
  17.  *    documentation and/or other materials provided with the distribution.
  18.  * 3. All advertising materials mentioning features or use of this software
  19.  *    must display the following acknowledgement:
  20.  *    This product includes software developed by the University of
  21.  *    California, Berkeley and its contributors.
  22.  * 4. Neither the name of the University nor the names of its contributors
  23.  *    may be used to endorse or promote products derived from this software
  24.  *    without specific prior written permission.
  25.  *
  26.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  27.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  29.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  30.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  31.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  32.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  33.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  34.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  35.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  36.  * SUCH DAMAGE.
  37.  */
  38. #ifndef _h_tc_wait
  39. #define _h_tc_wait
  40.  
  41. /*
  42.  * a little complicated #include <sys/wait.h>! :-(
  43.  * We try to use the system's wait.h when we can...
  44.  */
  45.  
  46. #if SVID > 0
  47. # ifdef hpux
  48. #  ifndef __hpux
  49. #   define NEEDwait
  50. #  else
  51. #   ifndef POSIX
  52. #    define _BSD
  53. #   endif
  54. #   ifndef _CLASSIC_POSIX_TYPES
  55. #    define _CLASSIC_POSIX_TYPES
  56. #   endif
  57. #   include <sys/wait.h> /* 7.0 fixed it again */
  58. #  endif /* __hpux */
  59. # else /* hpux */
  60. #  if defined(OREO) || defined(IRIS4D) || defined(POSIX)
  61. #   include <sys/wait.h>
  62. #  else    /* OREO || IRIS4D || POSIX */
  63. #   define NEEDwait
  64. #  endif /* OREO || IRIS4D || POSIX */
  65. # endif    /* hpux */
  66. #else /* SVID == 0 */
  67. # include <sys/wait.h>
  68. #endif /* SVID == 0 */
  69.  
  70. #ifdef _MINIX
  71. # undef NEEDwait
  72. # include "mi.wait.h"
  73. #endif /* _MINIX */
  74.  
  75. #ifdef NEEDwait
  76. /*
  77.  *    This wait is for big-endians and little endians
  78.  */
  79. union wait {
  80.     int     w_status;
  81. # ifdef _SEQUENT_
  82.     struct {
  83.     unsigned short w_Termsig:7;
  84.     unsigned short w_Coredump:1;
  85.     unsigned short w_Retcode:8;
  86.     }       w_T;
  87.     struct {
  88.     unsigned short w_Stopval:8;
  89.     unsigned short w_Stopsig:8;
  90.     }       w_S;
  91. };
  92.  
  93. #  define w_termsig     w_T.w_Termsig
  94. #  define w_coredump    w_T.w_Coredump
  95. #  define w_retcode     w_T.w_Retcode
  96. #  define w_stopval     w_S.w_Stopval
  97. #  define w_stopsig     w_S.w_Stopsig
  98. # else /* _SEQUENT_ */
  99. #  if defined(vax) || defined(i386)
  100.     union {
  101.     struct {
  102.         unsigned int w_Termsig:7;
  103.         unsigned int w_Coredump:1;
  104.         unsigned int w_Retcode:8;
  105.         unsigned int w_Dummy:16;
  106.     }       w_T;
  107.     struct {
  108.         unsigned int w_Stopval:8;
  109.         unsigned int w_Stopsig:8;
  110.         unsigned int w_Dummy:16;
  111.     }       w_S;
  112.     }       w_P;
  113. #  else /* mc68000 || sparc || ??? */
  114.     union {
  115.     struct {
  116.         unsigned int w_Dummy:16;
  117.         unsigned int w_Retcode:8;
  118.         unsigned int w_Coredump:1;
  119.         unsigned int w_Termsig:7;
  120.     }       w_T;
  121.     struct {
  122.         unsigned int w_Dummy:16;
  123.         unsigned int w_Stopsig:8;
  124.         unsigned int w_Stopval:8;
  125.     }       w_S;
  126.     }       w_P;
  127. #  endif /* vax || i386 */
  128. };
  129.  
  130. #  define w_termsig    w_P.w_T.w_Termsig
  131. #  define w_coredump    w_P.w_T.w_Coredump
  132. #  define w_retcode    w_P.w_T.w_Retcode
  133. #  define w_stopval    w_P.w_S.w_Stopval
  134. #  define w_stopsig    w_P.w_S.w_Stopsig
  135. # endif /* _SEQUENT_ */
  136.  
  137.  
  138. # ifndef WNOHANG
  139. #  define WNOHANG    1    /* dont hang in wait */
  140. # endif
  141.  
  142. # ifndef WUNTRACED
  143. #  define WUNTRACED    2    /* tell about stopped, untraced children */
  144. # endif
  145.  
  146. # define WSTOPPED 0177
  147. # define WIFSTOPPED(x)    ((x).w_stopval == WSTOPPED)
  148. # define WIFSIGNALED(x)    (((x).w_stopval != WSTOPPED) && ((x).w_termsig != 0))
  149.  
  150. #endif /* NEEDwait */
  151.  
  152. #endif /* _h_tc_wait */
  153.