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