summaryrefslogtreecommitdiffstats
path: root/regress/sys/kern/wait/wait.c
diff options
context:
space:
mode:
authormickey <mickey@openbsd.org>2003-11-04 07:38:08 +0000
committermickey <mickey@openbsd.org>2003-11-04 07:38:08 +0000
commit443d97398cd98b6ec7313c67c56e8e9d9b13a56d (patch)
tree27e64fa345437a36c151eefb1dbef5fafe192682 /regress/sys/kern/wait/wait.c
parenta simpler test for __syscall args alignment (diff)
downloadwireguard-openbsd-443d97398cd98b6ec7313c67c56e8e9d9b13a56d.tar.xz
wireguard-openbsd-443d97398cd98b6ec7313c67c56e8e9d9b13a56d.zip
old __syscall test is really a wait() test
Diffstat (limited to 'regress/sys/kern/wait/wait.c')
-rw-r--r--regress/sys/kern/wait/wait.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/regress/sys/kern/wait/wait.c b/regress/sys/kern/wait/wait.c
new file mode 100644
index 00000000000..1b93de0ac20
--- /dev/null
+++ b/regress/sys/kern/wait/wait.c
@@ -0,0 +1,35 @@
+/* $OpenBSD: wait.c,v 1.1 2003/11/04 07:38:08 mickey Exp $ */
+/*
+ * Written by Artur Grabowski <art@openbsd.org> 2002 Public Domain.
+ */
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <err.h>
+
+int
+main()
+{
+ int status;
+
+ switch(fork()) {
+ case -1:
+ err(1, "fork");
+ case 0:
+ __syscall((u_int64_t)SYS_exit, 17, 0);
+ abort();
+ }
+
+ if (wait(&status) < 0)
+ err(1, "wait");
+
+ if (!WIFEXITED(status))
+ errx(1, "child didn't exit gracefully");
+
+ if (WEXITSTATUS(status) != 17)
+ errx(1, "wrong exit status");
+
+ return 0;
+}