1 /* $NetBSD: ksh_wait.h,v 1.2 1997/01/12 19:12:03 tls Exp $ */
3 /* Wrapper around the ugly sys/wait includes/ifdefs */
4 /* $NetBSD: ksh_wait.h,v 1.2 1997/01/12 19:12:03 tls Exp $ */
10 #ifndef POSIX_SYS_WAIT
11 /* Get rid of system macros (which probably use union wait) */
19 #endif /* POSIX_SYS_WAIT */
24 # define WIFCORED(s) ((s) & 0x80)
26 #define WSTATUS(s) (s)
29 # define WIFEXITED(s) (((s) & 0xff) == 0)
32 # define WEXITSTATUS(s) (((s) >> 8) & 0xff)
35 # define WIFSIGNALED(s) (((s) & 0xff) != 0 && ((s) & 0xff) != 0x7f)
38 # define WTERMSIG(s) ((s) & 0x7f)
41 # define WIFSTOPPED(s) (((s) & 0xff) == 0x7f)
44 # define WSTOPSIG(s) (((s) >> 8) & 0xff)
47 #if !defined(HAVE_WAITPID) && defined(HAVE_WAIT3)
48 /* always used with p == -1 */
49 # define ksh_waitpid(p, s, o) wait3((s), (o), (struct rusage *) 0)
50 #else /* !HAVE_WAITPID && HAVE_WAIT3 */
51 # define ksh_waitpid(p, s, o) waitpid((p), (s), (o))
52 #endif /* !HAVE_WAITPID && HAVE_WAIT3 */