summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls/stat.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-12-17 11:22:27 +0100
committerAndreas Kling <kling@serenityos.org>2021-12-18 11:30:10 +0100
commit0ae870269226f7eee92a2aed119f46d408da9400 (patch)
treefc334d9ae3cd5ce746b88998b831cd619437f3c1 /Kernel/Syscalls/stat.cpp
parent1f2d0d0ad4ddb1ca0c6f47f2a8323f42af0f0673 (diff)
downloadserenity-0ae870269226f7eee92a2aed119f46d408da9400.zip
Kernel: Make File::stat() & friends return Error<struct stat>
Instead of making the caller provide a stat buffer, let's just return one as a value.
Diffstat (limited to 'Kernel/Syscalls/stat.cpp')
-rw-r--r--Kernel/Syscalls/stat.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/Kernel/Syscalls/stat.cpp b/Kernel/Syscalls/stat.cpp
index 692eb30f7e..a646d5a505 100644
--- a/Kernel/Syscalls/stat.cpp
+++ b/Kernel/Syscalls/stat.cpp
@@ -16,8 +16,7 @@ ErrorOr<FlatPtr> Process::sys$fstat(int fd, Userspace<stat*> user_statbuf)
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
REQUIRE_PROMISE(stdio);
auto description = TRY(fds().open_file_description(fd));
- stat buffer = {};
- TRY(description->stat(buffer));
+ auto buffer = TRY(description->stat());
TRY(copy_to_user(user_statbuf, &buffer));
return 0;
}
@@ -42,8 +41,7 @@ ErrorOr<FlatPtr> Process::sys$stat(Userspace<const Syscall::SC_stat_params*> use
base = base_description->custody();
}
auto metadata = TRY(VirtualFileSystem::the().lookup_metadata(path->view(), *base, params.follow_symlinks ? 0 : O_NOFOLLOW_NOERROR));
- stat statbuf = {};
- TRY(metadata.stat(statbuf));
+ auto statbuf = TRY(metadata.stat());
TRY(copy_to_user(params.statbuf, &statbuf));
return 0;
}