summaryrefslogtreecommitdiff
path: root/kernel/syscalls/open.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/syscalls/open.c')
-rw-r--r--kernel/syscalls/open.c14
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;
+}