From 1d2a6f21294f8390b683e4e097cb49210ed832d1 Mon Sep 17 00:00:00 2001 From: johannst Date: Fri, 26 Mar 2021 23:17:46 +0100 Subject: Added dyn allocator + syscall wrappers + minor fixes. --- lib/src/syscalls.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 lib/src/syscalls.c (limited to 'lib/src/syscalls.c') diff --git a/lib/src/syscalls.c b/lib/src/syscalls.c new file mode 100644 index 0000000..d6ac1a5 --- /dev/null +++ b/lib/src/syscalls.c @@ -0,0 +1,22 @@ +// Copyright (c) 2021 Johannes Stoelp + +#include // __NR_* +#include +#include + +int open(const char* path, int flags) { + return syscall2(__NR_open, path, flags); +} + +ssize_t read(int fd, void* buf, size_t count) { + return syscall3(__NR_read, fd, buf, count); +} + +off_t lseek(int fd, off_t offset, int whence) { + return syscall3(__NR_lseek, fd, offset, whence); +} + +void _exit(int status) { + syscall1(__NR_exit, status); + __builtin_unreachable(); +} -- cgit v1.2.3