From e8c2ba70657e0773cb4ad8396857f7f8403541ae Mon Sep 17 00:00:00 2001 From: Artur Grabowski Date: Fri, 8 Feb 2002 21:39:23 +0000 Subject: same as the test for syscall(2), but for __syscall(2) --- regress/sys/kern/__syscall/Makefile | 5 +++++ regress/sys/kern/__syscall/__syscall.c | 35 ++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 regress/sys/kern/__syscall/Makefile create mode 100644 regress/sys/kern/__syscall/__syscall.c (limited to 'regress') 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 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 2002 Public Domain. + */ +#include +#include +#include +#include +#include +#include + +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; +} -- cgit v1.2.3