1 /* $Id: wait.h 5398 2002-04-09 07:21:58Z rra $
3 ** Portability wrapper around <sys/wait.h>.
5 ** This header includes <sys/wait.h> if it's available, and then makes sure
6 ** that the standard wait macros are defined and defines them if they
10 #ifndef PORTABLE_WAIT_H
11 #define PORTABLE_WAIT_H 1
15 #ifdef HAVE_SYS_WAIT_H
16 # include <sys/wait.h>
19 /* Per the autoconf documentation, just always check to see if the various
20 macros are defined and define them ourselves if they aren't. These
21 definitions are based on the approach taken by BSDI. */
23 # define WCOREDUMP(status) ((unsigned)(status) & 0x80)
26 # define WEXITSTATUS(status) (((unsigned)(status) >> 8) & 0xff)
29 # define WTERMSIG(status) ((unsigned)(status) & 0x7f)
32 # define WIFEXITED(status) (((unsigned)(status) & 0xff) == 0)
35 # define WIFSTOPPED(status) (((unsigned)(status) & 0xff) == 0x7f)
38 # define WIFSIGNALED(status) (!WIFSTOPPED(status) && !WIFEXITED(status))
41 #endif /* PORTABLE_WAIT_H */