chiark / gitweb /
Commit 2.4.5-5 as unpacked
[inn-innduct.git] / include / portable / wait.h
1 /*  $Id: wait.h 5398 2002-04-09 07:21:58Z rra $
2 **
3 **  Portability wrapper around <sys/wait.h>.
4 **
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
7 **  aren't.
8 */
9
10 #ifndef PORTABLE_WAIT_H
11 #define PORTABLE_WAIT_H 1
12
13 #include "config.h"
14
15 #ifdef HAVE_SYS_WAIT_H
16 # include <sys/wait.h>
17 #endif
18
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. */
22 #ifndef WCOREDUMP
23 # define WCOREDUMP(status)      ((unsigned)(status) & 0x80)
24 #endif
25 #ifndef WEXITSTATUS
26 # define WEXITSTATUS(status)    (((unsigned)(status) >> 8) & 0xff)
27 #endif
28 #ifndef WTERMSIG
29 # define WTERMSIG(status)       ((unsigned)(status) & 0x7f)
30 #endif
31 #ifndef WIFEXITED
32 # define WIFEXITED(status)      (((unsigned)(status) & 0xff) == 0)
33 #endif
34 #ifndef WIFSTOPPED
35 # define WIFSTOPPED(status)     (((unsigned)(status) & 0xff) == 0x7f)
36 #endif
37 #ifndef WIFSIGNALED
38 # define WIFSIGNALED(status)    (!WIFSTOPPED(status) && !WIFEXITED(status))
39 #endif
40
41 #endif /* PORTABLE_WAIT_H */