1 /* 2 * $Id: uwait.h,v 5.2 90/06/23 22:20:31 jsp Rel $ 3 * 4 * Copyright (c) 1989 Jan-Simon Pendry 5 * Copyright (c) 1989 Imperial College of Science, Technology & Medicine 6 * Copyright (c) 1989 The Regents of the University of California. 7 * All rights reserved. 8 * 9 * This code is derived from software contributed to Berkeley by 10 * Jan-Simon Pendry at Imperial College, London. 11 * 12 * %sccs.include.redist.c% 13 * 14 * @(#)uwait.h 5.1 (Berkeley) 07/19/90 15 */ 16 17 #if defined(mc68k) || defined(mc68000) || defined(mc68020) || defined(sparc) || defined(hp9000s300) 18 #define BITS_BIGENDIAN 19 #endif 20 #if defined(vax) || defined(i386) 21 #define BITS_LITTLENDIAN 22 #endif 23 #if !defined BITS_BIGENDIAN && !defined BITS_LITTLENDIAN 24 #error Do not know my byte ordering 25 #endif 26 27 /* 28 * Structure of the information in the first word returned by both 29 * wait and wait3. If w_stopval==WSTOPPED, then the second structure 30 * describes the information returned, else the first. See WUNTRACED below. 31 */ 32 union wait { 33 int w_status; /* used in syscall */ 34 /* 35 * Terminated process status. 36 */ 37 struct { 38 #ifdef BITS_LITTLENDIAN 39 unsigned short w_Termsig:7; /* termination signal */ 40 unsigned short w_Coredump:1; /* core dump indicator */ 41 unsigned short w_Retcode:8; /* exit code if w_termsig==0 */ 42 #endif 43 #ifdef BITS_BIGENDIAN 44 unsigned short w_Fill1:16; /* high 16 bits unused */ 45 unsigned short w_Retcode:8; /* exit code if w_termsig==0 */ 46 unsigned short w_Coredump:1; /* core dump indicator */ 47 unsigned short w_Termsig:7; /* termination signal */ 48 #endif 49 } w_U; 50 }; 51 #define w_termsig w_U.w_Termsig 52 #define w_coredump w_U.w_Coredump 53 #define w_retcode w_U.w_Retcode 54 55 #define WIFSIGNALED(x) ((x).w_termsig != 0) 56 #define WIFEXITED(x) ((x).w_termsig == 0) 57