summaryrefslogtreecommitdiff
path: root/kernel/syscalls/open.c
blob: ef5297bd5ff1992a2c9c645e1b29d942a88d89f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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;
}