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