summaryrefslogtreecommitdiff
path: root/src/regress/lib/libc/sys/macros.h
diff options
context:
space:
mode:
authorbluhm <>2019-11-19 19:57:04 +0000
committerbluhm <>2019-11-19 19:57:04 +0000
commit9185f840eda265016178aeb0dcdba964f8f6f3e2 (patch)
treeda100b3712514c566fe948116f7926ad7f725401 /src/regress/lib/libc/sys/macros.h
parent6a6fe688152b422f3d65c970dad56e7d9d28b1ee (diff)
downloadopenbsd-9185f840eda265016178aeb0dcdba964f8f6f3e2.tar.gz
openbsd-9185f840eda265016178aeb0dcdba964f8f6f3e2.tar.bz2
openbsd-9185f840eda265016178aeb0dcdba964f8f6f3e2.zip
Import NetBSD system call regression tests. They were written with
ATF (Automated Testing Framework), so we use a small wrapper to map it to our bsd.regress.mk framework. Only half of the 80 NetBSD tests have been taken, the others need more work to adapt. Of them 34 syscall tests pass. Moritz Buhl ported the tests to OpenBSD.
Diffstat (limited to 'src/regress/lib/libc/sys/macros.h')
-rw-r--r--src/regress/lib/libc/sys/macros.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/regress/lib/libc/sys/macros.h b/src/regress/lib/libc/sys/macros.h
new file mode 100644
index 0000000000..932f230c03
--- /dev/null
+++ b/src/regress/lib/libc/sys/macros.h
@@ -0,0 +1,55 @@
1/* $OpenBSD: macros.h,v 1.1.1.1 2019/11/19 19:57:03 bluhm Exp $ */
2/* Public domain - Moritz Buhl */
3
4#include <sys/param.h>
5#include <sys/socket.h>
6#include <sys/stdint.h>
7#include <sys/sysctl.h>
8#include <sys/types.h>
9
10#include <stdbool.h>
11#include <string.h>
12
13#define __RCSID(str)
14#define __COPYRIGHT(str)
15
16#define __arraycount(_a) nitems(_a)
17#define __unreachable() atf_tc_fail("unreachable")
18#define __UNCONST(a) (a)
19
20/* t_chroot.c */
21#define fchroot(fd) 0
22
23/* t_clock_gettime.c */
24int sysctlbyname(char *, void *, size_t *, void *, size_t);
25
26int
27sysctlbyname(char* s, void *oldp, size_t *oldlenp, void *newp, size_t newlen)
28{
29 int ktc;
30 if (strcmp(s, "kern.timecounter.hardware") == 0)
31 ktc = KERN_TIMECOUNTER_HARDWARE;
32 else if (strcmp(s, "kern.timecounter.choice") == 0)
33 ktc = KERN_TIMECOUNTER_CHOICE;
34
35 int mib[3];
36 mib[0] = CTL_KERN;
37 mib[1] = KERN_TIMECOUNTER;
38 mib[2] = ktc;
39 return sysctl(mib, 3, oldp, oldlenp, newp, newlen);
40}
41
42/* t_mlock.c */
43#define MAP_WIRED __MAP_NOREPLACE
44
45/* t_pipe2.c */
46#define O_NOSIGPIPE 0
47
48/* t_poll.c */
49#define pollts(a, b, c, e) 0
50
51/* t_sendrecv.c */
52#define SO_RERROR SO_DEBUG
53
54/* t_write.c */
55#define _PATH_DEVZERO "/dev/zero"