2 /* $OpenLDAP: pkg/ldap/include/ac/wait.h,v 1.16.2.3 2008/02/11 23:26:40 kurt Exp $ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 1998-2008 The OpenLDAP Foundation.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
12 * A copy of this license is available in file LICENSE in the
13 * top-level directory of the distribution or, alternatively, at
14 * <http://www.OpenLDAP.org/license.html>.
20 #include <sys/types.h>
22 #ifdef HAVE_SYS_WAIT_H
23 # include <sys/wait.h>
26 #define LDAP_HI(s) (((s) >> 8) & 0377)
27 #define LDAP_LO(s) ((s) & 0377)
29 /* These should work on non-POSIX UNIX platforms,
30 all bets on off on non-POSIX non-UNIX platforms... */
32 # define WIFEXITED(s) (LDAP_LO(s) == 0)
35 # define WEXITSTATUS(s) LDAP_HI(s)
38 # define WIFSIGNALED(s) (LDAP_LO(s) > 0 && LDAP_HI(s) == 0)
41 # define WTERMSIG(s) (LDAP_LO(s) & 0177)
44 # define WIFSTOPPED(s) (LDAP_LO(s) == 0177 && LDAP_HI(s) != 0)
47 # define WSTOPSIG(s) LDAP_HI(s)
51 # define WAIT_FLAGS ( WNOHANG | WUNTRACED | WCONTINUED )
53 # define WAIT_FLAGS ( WNOHANG | WUNTRACED )
56 #endif /* _AC_WAIT_H */