diff options
author | Anton Kling <anton@kling.gg> | 2023-11-24 21:29:12 +0100 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2023-11-24 21:29:12 +0100 |
commit | 08b63b747f9a6b4d1460195f6ca68680abcdd656 (patch) | |
tree | 0a1b8620cd3b56bf1d9b389f44876e8c391bd47e /kernel/syscalls/open.c | |
parent | 6757803629574fe46e9047be8567e0c7e0522973 (diff) |
Refactor open()
Diffstat (limited to 'kernel/syscalls/open.c')
-rw-r--r-- | kernel/syscalls/open.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/kernel/syscalls/open.c b/kernel/syscalls/open.c new file mode 100644 index 0000000..b42a7a8 --- /dev/null +++ b/kernel/syscalls/open.c @@ -0,0 +1,14 @@ +#include <errno.h> +#include <syscalls.h> + +int syscall_open(const char *file, int flags, mode_t mode) { + const char *_file = copy_and_allocate_user_string(file); + if (!_file) { + return -EFAULT; + } + int _flags = flags; + int _mode = mode; + int rc = vfs_open(_file, _flags, _mode); + kfree((void*)_file); + return rc; +} |