diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2003-11-04 07:38:09 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2003-11-04 07:38:09 +0000 |
commit | 504f47951d34b0d731259bc032ba27f595c14046 (patch) | |
tree | 44092063a75d1e5a23cb234a29d98fde3efc2d61 /regress/sys/kern/wait | |
parent | fdd40f245000a3b5bebc83e24e137190baf44e06 (diff) |
old __syscall test is really a wait() test
Diffstat (limited to 'regress/sys/kern/wait')
-rw-r--r-- | regress/sys/kern/wait/Makefile | 5 | ||||
-rw-r--r-- | regress/sys/kern/wait/wait.c | 35 |
2 files changed, 40 insertions, 0 deletions
diff --git a/regress/sys/kern/wait/Makefile b/regress/sys/kern/wait/Makefile new file mode 100644 index 00000000000..2dd0918f03f --- /dev/null +++ b/regress/sys/kern/wait/Makefile @@ -0,0 +1,5 @@ +# $OpenBSD: Makefile,v 1.1 2003/11/04 07:38:08 mickey Exp $ + +PROG= wait + +.include <bsd.regress.mk> 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; +} |