From a288258785bac3c2000227532f4a17210813c506 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Thu, 16 Nov 2023 15:24:45 +0100 Subject: Kernel: Change how syscalls are built and implemented. --- kernel/syscalls/stat.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 kernel/syscalls/stat.c (limited to 'kernel/syscalls/stat.c') diff --git a/kernel/syscalls/stat.c b/kernel/syscalls/stat.c new file mode 100644 index 0000000..103ac34 --- /dev/null +++ b/kernel/syscalls/stat.c @@ -0,0 +1,12 @@ +#include +#include +#include + +int syscall_stat(SYS_STAT_PARAMS *args) { + const char *pathname = copy_and_allocate_user_string(args->pathname); + struct stat *statbuf = args->statbuf; + int fd = vfs_open(pathname, O_READ, 0); + int rc = vfs_fstat(fd, statbuf); + vfs_close(fd); + return rc; +} -- cgit v1.2.3