Back to index

openldap  2.4.31
wait.h
Go to the documentation of this file.
00001 /* Generic wait.h */
00002 /* $OpenLDAP$ */
00003 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
00004  *
00005  * Copyright 1998-2012 The OpenLDAP Foundation.
00006  * All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted only as authorized by the OpenLDAP
00010  * Public License.
00011  *
00012  * A copy of this license is available in file LICENSE in the
00013  * top-level directory of the distribution or, alternatively, at
00014  * <http://www.OpenLDAP.org/license.html>.
00015  */
00016 
00017 #ifndef _AC_WAIT_H
00018 #define _AC_WAIT_H
00019 
00020 #include <sys/types.h>
00021 
00022 #ifdef HAVE_SYS_WAIT_H
00023 # include <sys/wait.h>
00024 #endif
00025 
00026 #define LDAP_HI(s)   (((s) >> 8) & 0377)
00027 #define LDAP_LO(s)   ((s) & 0377)
00028 
00029 /* These should work on non-POSIX UNIX platforms,
00030        all bets on off on non-POSIX non-UNIX platforms... */
00031 #ifndef WIFEXITED
00032 # define WIFEXITED(s)       (LDAP_LO(s) == 0)
00033 #endif
00034 #ifndef WEXITSTATUS
00035 # define WEXITSTATUS(s) LDAP_HI(s)
00036 #endif
00037 #ifndef WIFSIGNALED
00038 # define WIFSIGNALED(s) (LDAP_LO(s) > 0 && LDAP_HI(s) == 0)
00039 #endif
00040 #ifndef WTERMSIG
00041 # define WTERMSIG(s) (LDAP_LO(s) & 0177)
00042 #endif
00043 #ifndef WIFSTOPPED
00044 # define WIFSTOPPED(s)      (LDAP_LO(s) == 0177 && LDAP_HI(s) != 0)
00045 #endif
00046 #ifndef WSTOPSIG
00047 # define WSTOPSIG(s) LDAP_HI(s)
00048 #endif
00049 
00050 #ifdef WCONTINUED
00051 # define WAIT_FLAGS ( WNOHANG | WUNTRACED | WCONTINUED )
00052 #else
00053 # define WAIT_FLAGS ( WNOHANG | WUNTRACED )
00054 #endif
00055 
00056 #endif /* _AC_WAIT_H */