12159047fSniklas /* Define how to access the int that the wait system call stores. 22159047fSniklas This has been compatible in all Unix systems since time immemorial, 32159047fSniklas but various well-meaning people have defined various different 42159047fSniklas words for the same old bits in the same old int (sometimes claimed 52159047fSniklas to be a struct). We just know it's an int and we use these macros 62159047fSniklas to access the bits. */ 72159047fSniklas 82159047fSniklas /* The following macros are defined equivalently to their definitions 92159047fSniklas in POSIX.1. We fail to define WNOHANG and WUNTRACED, which POSIX.1 102159047fSniklas <sys/wait.h> defines, since our code does not use waitpid(). We 112159047fSniklas also fail to declare wait() and waitpid(). */ 122159047fSniklas 13*c88b1d6cSniklas #ifndef WIFEXITED 142159047fSniklas #define WIFEXITED(w) (((w)&0377) == 0) 15*c88b1d6cSniklas #endif 16*c88b1d6cSniklas 17*c88b1d6cSniklas #ifndef WIFSIGNALED 182159047fSniklas #define WIFSIGNALED(w) (((w)&0377) != 0177 && ((w)&~0377) == 0) 19*c88b1d6cSniklas #endif 20*c88b1d6cSniklas 21*c88b1d6cSniklas #ifndef WIFSTOPPED 222159047fSniklas #ifdef IBM6000 232159047fSniklas 242159047fSniklas /* Unfortunately, the above comment (about being compatible in all Unix 252159047fSniklas systems) is not quite correct for AIX, sigh. And AIX 3.2 can generate 262159047fSniklas status words like 0x57c (sigtrap received after load), and gdb would 272159047fSniklas choke on it. */ 282159047fSniklas 292159047fSniklas #define WIFSTOPPED(w) ((w)&0x40) 302159047fSniklas 312159047fSniklas #else 322159047fSniklas #define WIFSTOPPED(w) (((w)&0377) == 0177) 332159047fSniklas #endif 34*c88b1d6cSniklas #endif 352159047fSniklas 36*c88b1d6cSniklas #ifndef WEXITSTATUS 372159047fSniklas #define WEXITSTATUS(w) (((w) >> 8) & 0377) /* same as WRETCODE */ 38*c88b1d6cSniklas #endif 39*c88b1d6cSniklas 40*c88b1d6cSniklas #ifndef WTERMSIG 412159047fSniklas #define WTERMSIG(w) ((w) & 0177) 42*c88b1d6cSniklas #endif 43*c88b1d6cSniklas 44*c88b1d6cSniklas #ifndef WSTOPSIG 452159047fSniklas #define WSTOPSIG WEXITSTATUS 46*c88b1d6cSniklas #endif 472159047fSniklas 482159047fSniklas /* These are not defined in POSIX, but are used by our programs. */ 492159047fSniklas 502159047fSniklas #define WAITTYPE int 512159047fSniklas 52*c88b1d6cSniklas #ifndef WCOREDUMP 532159047fSniklas #define WCOREDUMP(w) (((w)&0200) != 0) 54*c88b1d6cSniklas #endif 55*c88b1d6cSniklas 56*c88b1d6cSniklas #ifndef WSETEXIT 572159047fSniklas #define WSETEXIT(w,status) ((w) = (0 | ((status) << 8))) 58*c88b1d6cSniklas #endif 59*c88b1d6cSniklas 60*c88b1d6cSniklas #ifndef WSETSTOP 612159047fSniklas #define WSETSTOP(w,sig) ((w) = (0177 | ((sig) << 8))) 62*c88b1d6cSniklas #endif 63*c88b1d6cSniklas 64