hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/sysroot/usr/lib/libc/syscalls.c
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-10-12 23:08:48 +0200
committerhachem <im@hachem.wtf>2026-10-12 23:08:48 +0200
commit6a5543bb8f1f535ca49737bcd7be0cafca3b2a08 (patch)
treebb137b732a1d122aeace46c550733f4793d84601 /sysroot/usr/lib/libc/syscalls.c
parent59794d0b999e544a94230d9562bf2b99d2ed74c7 (diff)
feat: lib seaHEADmain
Diffstat (limited to 'sysroot/usr/lib/libc/syscalls.c')
-rw-r--r--sysroot/usr/lib/libc/syscalls.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/sysroot/usr/lib/libc/syscalls.c b/sysroot/usr/lib/libc/syscalls.c
new file mode 100644
index 0000000..ad959b9
--- /dev/null
+++ b/sysroot/usr/lib/libc/syscalls.c
@@ -0,0 +1,38 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/syscall.h>
+
+long read(int fd, void* buffer, size_t length)
+{
+ return __syscall3(SYS_read, fd, (long)buffer, (long)length);
+}
+
+long write(int fd, const void* buffer, size_t length)
+{
+ return __syscall3(SYS_write, fd, (long)buffer, (long)length);
+}
+
+int open(const char* path, int flags)
+{
+ return (int)__syscall2(SYS_open, (long)path, flags);
+}
+
+int close(int fd)
+{
+ return (int)__syscall1(SYS_close, fd);
+}
+
+long lseek(int fd, long offset, int whence)
+{
+ return __syscall3(SYS_lseek, fd, offset, whence);
+}
+
+void* sbrk(long increment)
+{
+ return (void*)__syscall1(SYS_sbrk, increment);
+}
+
+int brk(void* address)
+{
+ return (int)__syscall1(SYS_brk, (long)address);
+}