]> git.sur5r.net Git - openldap/blob - include/ac/wait.h
Import from devel
[openldap] / include / ac / wait.h
1 /* Generic wait.h */
2 /* $OpenLDAP$ */
3 /*
4  * Copyright 1998-2000 The OpenLDAP Foundation, Redwood City, California, USA
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms are permitted only
8  * as authorized by the OpenLDAP Public License.  A copy of this
9  * license is available at http://www.OpenLDAP.org/license.html or
10  * in file LICENSE in the top-level directory of the distribution.
11  */
12
13 #ifndef _AC_WAIT_H
14 #define _AC_WAIT_H
15
16 #include <sys/types.h>
17
18 #if HAVE_SYS_WAIT_H
19 # include <sys/wait.h>
20 #endif
21
22 #define LDAP_HI(s)      (((s) >> 8) & 0377)
23 #define LDAP_LO(s)      ((s) & 0377)
24
25 /* These should work on non-POSIX UNIX platforms,
26         all bets on off on non-POSIX non-UNIX platforms... */
27 #ifndef WIFEXITED
28 # define WIFEXITED(s)   (LDAP_LO(s) == 0)
29 #endif
30 #ifndef WEXITSTATUS
31 # define WEXITSTATUS(s) LDAP_HI(s)
32 #endif
33 #ifndef WIFSIGNALED
34 # define WIFSIGNALED(s) (LDAP_LO(s) > 0 && LDAP_HI(s) == 0)
35 #endif
36 #ifndef WTERMSIG
37 # define WTERMSIG(s)    (LDAP_LO(s) & 0177)
38 #endif
39 #ifndef WIFSTOPPED
40 # define WIFSTOPPED(s)  (LDAP_LO(s) == 0177 && LDAP_HI(s) != 0)
41 #endif
42 #ifndef WSTOPSIG
43 # define WSTOPSIG(s)    LDAP_HI(s)
44 #endif
45
46 #ifdef WCONTINUED
47 # define WAIT_FLAGS ( WNOHANG | WUNTRACED | WCONTINUED )
48 #else
49 # define WAIT_FLAGS ( WNOHANG | WUNTRACED )
50 #endif
51
52 #endif /* _AC_WAIT_H */