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