1 /* Generic wait.h */ 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/>. 4 * 5 * Copyright 1998-2008 The OpenLDAP Foundation. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted only as authorized by the OpenLDAP 10 * Public License. 11 * 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>. 15 */ 16 17 #ifndef _AC_WAIT_H 18 #define _AC_WAIT_H 19 20 #include <sys/types.h> 21 22 #ifdef HAVE_SYS_WAIT_H 23 # include <sys/wait.h> 24 #endif 25 26 #define LDAP_HI(s) (((s) >> 8) & 0377) 27 #define LDAP_LO(s) ((s) & 0377) 28 29 /* These should work on non-POSIX UNIX platforms, 30 all bets on off on non-POSIX non-UNIX platforms... */ 31 #ifndef WIFEXITED 32 # define WIFEXITED(s) (LDAP_LO(s) == 0) 33 #endif 34 #ifndef WEXITSTATUS 35 # define WEXITSTATUS(s) LDAP_HI(s) 36 #endif 37 #ifndef WIFSIGNALED 38 # define WIFSIGNALED(s) (LDAP_LO(s) > 0 && LDAP_HI(s) == 0) 39 #endif 40 #ifndef WTERMSIG 41 # define WTERMSIG(s) (LDAP_LO(s) & 0177) 42 #endif 43 #ifndef WIFSTOPPED 44 # define WIFSTOPPED(s) (LDAP_LO(s) == 0177 && LDAP_HI(s) != 0) 45 #endif 46 #ifndef WSTOPSIG 47 # define WSTOPSIG(s) LDAP_HI(s) 48 #endif 49 50 #ifdef WCONTINUED 51 # define WAIT_FLAGS ( WNOHANG | WUNTRACED | WCONTINUED ) 52 #else 53 # define WAIT_FLAGS ( WNOHANG | WUNTRACED ) 54 #endif 55 56 #endif /* _AC_WAIT_H */ 57