Kernel/LibC: add SYS_STAT and stat(), lstat()

This commit is contained in:
2023-06-05 14:36:17 +03:00
parent 30bb61a775
commit 9d64dbd5c2
10 changed files with 75 additions and 9 deletions

View File

@@ -5,6 +5,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <unistd.h>
@@ -145,6 +146,14 @@ long syscall(long syscall, ...)
ret = Kernel::syscall(SYS_WAIT, pid, (uintptr_t)stat_loc, options);
break;
}
case SYS_STAT:
{
const char* path = va_arg(args, const char*);
struct stat* buf = va_arg(args, struct stat*);
int flags = va_arg(args, int);
ret = Kernel::syscall(SYS_STAT, (uintptr_t)path, (uintptr_t)buf, flags);
break;
}
default:
puts("LibC: Unhandeled syscall");
ret = -ENOSYS;