summaryrefslogtreecommitdiff
path: root/regress/sys
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2003-11-04 07:28:06 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2003-11-04 07:28:06 +0000
commitfdd40f245000a3b5bebc83e24e137190baf44e06 (patch)
treea58ed13f339a2a18b10aae02dd239e26812f6d12 /regress/sys
parent5a4000d5e757fc698a7b416df1a4f5e128d0b592 (diff)
a simpler test for __syscall args alignment
Diffstat (limited to 'regress/sys')
-rw-r--r--regress/sys/kern/__syscall/__syscall.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/regress/sys/kern/__syscall/__syscall.c b/regress/sys/kern/__syscall/__syscall.c
index 62a75db735c..e7c45e3a9cc 100644
--- a/regress/sys/kern/__syscall/__syscall.c
+++ b/regress/sys/kern/__syscall/__syscall.c
@@ -1,35 +1,33 @@
-/* $OpenBSD: __syscall.c,v 1.3 2003/07/31 21:48:07 deraadt Exp $ */
+/* $OpenBSD: __syscall.c,v 1.4 2003/11/04 07:28:05 mickey Exp $ */
+
/*
- * Written by Artur Grabowski <art@openbsd.org> 2002 Public Domain.
+ * Written by Michael Shalayeff <mickey@openbsd.org> 2003 Public Domain.
*/
+
#include <sys/types.h>
#include <sys/syscall.h>
-#include <sys/wait.h>
#include <unistd.h>
#include <stdlib.h>
+#include <fcntl.h>
#include <err.h>
int
-main(int argc, char *argv[])
+main(void)
{
- int status;
-
- switch(fork()) {
- case -1:
- err(1, "fork");
- case 0:
- __syscall((u_int64_t)SYS_exit, (u_int64_t)17);
- abort();
- }
+ extern off_t __syscall();
+ off_t off;
+ int fd;
- if (wait(&status) < 0)
- err(1, "wait");
+ if ((fd = open("/etc/passwd", O_RDONLY)) < 0)
+ err(1, "/etc/passwd");
- if (!WIFEXITED(status))
- errx(1, "child didn't exit gracefully");
+ off = __syscall((u_int64_t)SYS_lseek, fd, 0, (off_t)1, SEEK_SET);
+ if (off < 0)
+ err(1, "lseek");
- if (WEXITSTATUS(status) != 17)
- errx(1, "wrong exit status");
+ off = __syscall((u_int64_t)SYS_lseek, fd, 0, (off_t)0, SEEK_CUR);
+ if (off != 1)
+ errx(1, "lseek: wrong position %llu", off);
return 0;
}