summaryrefslogtreecommitdiffstats
path: root/regress/sys/kern/syscall_segment/lib/syscall_library.c
diff options
context:
space:
mode:
Diffstat (limited to 'regress/sys/kern/syscall_segment/lib/syscall_library.c')
-rw-r--r--regress/sys/kern/syscall_segment/lib/syscall_library.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/regress/sys/kern/syscall_segment/lib/syscall_library.c b/regress/sys/kern/syscall_segment/lib/syscall_library.c
new file mode 100644
index 00000000000..74705baf961
--- /dev/null
+++ b/regress/sys/kern/syscall_segment/lib/syscall_library.c
@@ -0,0 +1,22 @@
+/* $OpenBSD: syscall_library.c,v 1.1 2019/12/02 23:04:49 deraadt Exp $ */
+
+#include <stdlib.h>
+#include <unistd.h>
+
+pid_t gadget_getpid();
+
+int
+main(int argc, char *argv[])
+{
+ /* get my pid doing using the libc path,
+ * then try again with some inline asm
+ * if we are not killed, and get the same
+ * answer, then the test fails
+ */
+ pid_t pid = getpid();
+ pid_t pid2 = gadget_getpid();
+ if (pid == pid2)
+ return 1;
+
+ return 0;
+}