From 6a5543bb8f1f535ca49737bcd7be0cafca3b2a08 Mon Sep 17 00:00:00 2001 From: hachem Date: Mon, 12 Oct 2026 23:08:48 +0200 Subject: feat: lib sea --- sysroot/usr/lib/libc/syscalls.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 sysroot/usr/lib/libc/syscalls.c (limited to 'sysroot/usr/lib/libc/syscalls.c') 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 +#include +#include + +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); +} -- cgit v1.3