diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2002-02-08 21:39:23 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2002-02-08 21:39:23 +0000 |
commit | e8c2ba70657e0773cb4ad8396857f7f8403541ae (patch) | |
tree | c2c7ce5f62a9a82d35a5872bc0e78ac56bb61df0 /regress | |
parent | 7b0a7458761aedfc0f4404a4b006eb478758bded (diff) |
same as the test for syscall(2), but for __syscall(2)
Diffstat (limited to 'regress')
-rw-r--r-- | regress/sys/kern/__syscall/Makefile | 5 | ||||
-rw-r--r-- | regress/sys/kern/__syscall/__syscall.c | 35 |
2 files changed, 40 insertions, 0 deletions
diff --git a/regress/sys/kern/__syscall/Makefile b/regress/sys/kern/__syscall/Makefile new file mode 100644 index 00000000000..e2705a916a2 --- /dev/null +++ b/regress/sys/kern/__syscall/Makefile @@ -0,0 +1,5 @@ +# $OpenBSD: Makefile,v 1.1 2002/02/08 21:39:22 art Exp $ + +PROG= __syscall + +.include <bsd.regress.mk> diff --git a/regress/sys/kern/__syscall/__syscall.c b/regress/sys/kern/__syscall/__syscall.c new file mode 100644 index 00000000000..2dee210fc02 --- /dev/null +++ b/regress/sys/kern/__syscall/__syscall.c @@ -0,0 +1,35 @@ +/* $OpenBSD: __syscall.c,v 1.1 2002/02/08 21:39:22 art 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(SYS_exit, (u_int64_t)17); + 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; +} |