diff options
author | Anton Kling <anton@kling.gg> | 2023-11-15 02:43:03 +0100 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2023-11-15 02:55:54 +0100 |
commit | 6747f9407a061684c2fba837541c254f48bfcff0 (patch) | |
tree | f4d323bb6569ce755ae6425488c211387849a2f7 /kernel/scalls/stat.c | |
parent | 6fc8ef497409f83201aa92094d725407861881e7 (diff) |
VFS: Add stat
Diffstat (limited to 'kernel/scalls/stat.c')
-rw-r--r-- | kernel/scalls/stat.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/kernel/scalls/stat.c b/kernel/scalls/stat.c index 0850151..9fc115b 100644 --- a/kernel/scalls/stat.c +++ b/kernel/scalls/stat.c @@ -5,9 +5,8 @@ int syscall_stat(SYS_STAT_PARAMS *args) { const char *pathname = copy_and_allocate_user_string(args->pathname); struct stat *statbuf = args->statbuf; - vfs_inode_t *i = vfs_internal_open(pathname); - if (!i) - return -ENOENT; - statbuf->st_size = i->file_size; - return 0; + int fd = vfs_open(pathname, O_READ, 0); + int rc = vfs_fstat(fd, statbuf); + vfs_close(fd); + return rc; } |