summaryrefslogtreecommitdiff
path: root/kernel/scalls/stat.c
blob: 9fc115b0c2758d9c7dfa96650d1de00c128f0ed2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#include <errno.h>
#include <fs/vfs.h>
#include <scalls/stat.h>

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;
}