summaryrefslogtreecommitdiff
path: root/nonstd/stubs/unistd.h
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-01-26 22:41:05 -0500
committerJakob Kaivo <jkk@ung.org>2019-01-26 22:41:05 -0500
commit8c6d4505329f94446084ca93eae10cd796d79a8d (patch)
treec00c6a990c81bd771ebcac72b38fd3ce2382c42e /nonstd/stubs/unistd.h
new framework for building sources after gitlab migration
Diffstat (limited to 'nonstd/stubs/unistd.h')
-rw-r--r--nonstd/stubs/unistd.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/nonstd/stubs/unistd.h b/nonstd/stubs/unistd.h
new file mode 100644
index 00000000..8e16c2e8
--- /dev/null
+++ b/nonstd/stubs/unistd.h
@@ -0,0 +1,15 @@
+#ifndef __UNISTD_H__
+#define __UNISTD_H__
+
+#include <stddef.h>
+#include "nonstd/syscall.h"
+
+#define open(path, mode, flags) __libc.syscall(__libc.syscall_lookup("open"), path, mode, flags)
+#define close(fd) __libc.syscall(__libc.syscall_lookup("close"), fd)
+#define write(fd, buf, nbyte) __libc.syscall(__libc.syscall_lookup("write"), fd, buf, nbyte)
+#define read(fd, buf, nbyte) __libc.syscall(__libc.syscall_lookup("read"), fd, buf, nbyte)
+#define kill(pid, sig) __libc.syscall(__libc.syscall_lookup("kill"), pid, sig)
+#define getpid() __libc.syscall(__libc.syscall_lookup("getpid"))
+#define _exit(status) __libc.syscall(__libc.syscall_lookup("exit"), status)
+
+#endif