summaryrefslogtreecommitdiff
path: root/bin/pdksh/ksh_wait.h
diff options
context:
space:
mode:
authorJason Downs <downsj@cvs.openbsd.org>1996-08-14 06:19:13 +0000
committerJason Downs <downsj@cvs.openbsd.org>1996-08-14 06:19:13 +0000
commit3039b959c7de1e35fe4ec27ae02f1c8fe8d4d4ac (patch)
tree09c6b5a4f13282e07afe153445fcfaa0d10651f4 /bin/pdksh/ksh_wait.h
parent596c2317eee31ab9606c6b88085644407d4d2f0f (diff)
Import pdksh 5.2.7.
Diffstat (limited to 'bin/pdksh/ksh_wait.h')
-rw-r--r--bin/pdksh/ksh_wait.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/bin/pdksh/ksh_wait.h b/bin/pdksh/ksh_wait.h
new file mode 100644
index 00000000000..16fad066768
--- /dev/null
+++ b/bin/pdksh/ksh_wait.h
@@ -0,0 +1,51 @@
+/* $OpenBSD: ksh_wait.h,v 1.1 1996/08/14 06:19:11 downsj Exp $ */
+
+/* Wrapper around the ugly sys/wait includes/ifdefs */
+
+#ifdef HAVE_SYS_WAIT_H
+# include <sys/wait.h>
+#endif
+
+#ifndef POSIX_SYS_WAIT
+/* Get rid of system macros (which probably use union wait) */
+# undef WIFCORED
+# undef WIFEXITED
+# undef WEXITSTATUS
+# undef WIFSIGNALED
+# undef WTERMSIG
+# undef WIFSTOPPED
+# undef WSTOPSIG
+#endif /* POSIX_SYS_WAIT */
+
+typedef int WAIT_T;
+
+#ifndef WIFCORED
+# define WIFCORED(s) ((s) & 0x80)
+#endif
+#define WSTATUS(s) (s)
+
+#ifndef WIFEXITED
+# define WIFEXITED(s) (((s) & 0xff) == 0)
+#endif
+#ifndef WEXITSTATUS
+# define WEXITSTATUS(s) (((s) >> 8) & 0xff)
+#endif
+#ifndef WIFSIGNALED
+# define WIFSIGNALED(s) (((s) & 0xff) != 0 && ((s) & 0xff) != 0x7f)
+#endif
+#ifndef WTERMSIG
+# define WTERMSIG(s) ((s) & 0x7f)
+#endif
+#ifndef WIFSTOPPED
+# define WIFSTOPPED(s) (((s) & 0xff) == 0x7f)
+#endif
+#ifndef WSTOPSIG
+# define WSTOPSIG(s) (((s) >> 8) & 0xff)
+#endif
+
+#if !defined(HAVE_WAITPID) && defined(HAVE_WAIT3)
+ /* always used with p == -1 */
+# define ksh_waitpid(p, s, o) wait3((s), (o), (struct rusage *) 0)
+#else /* !HAVE_WAITPID && HAVE_WAIT3 */
+# define ksh_waitpid(p, s, o) waitpid((p), (s), (o))
+#endif /* !HAVE_WAITPID && HAVE_WAIT3 */