1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

Kernel: Don't copy a Vector<FileDescriptionAndFlags>

Instead of copying a Vector everytime we need to enumerate a Process'
file descriptions, we can just temporarily lock so it won't change.
This commit is contained in:
Liav A 2021-06-22 21:22:17 +03:00 committed by Andreas Kling
parent 12b6e69150
commit 7c87891c06
28 changed files with 198 additions and 128 deletions

View file

@ -15,7 +15,7 @@ namespace Kernel {
KResultOr<FlatPtr> Process::sys$fstat(int fd, Userspace<stat*> user_statbuf)
{
REQUIRE_PROMISE(stdio);
auto description = file_description(fd);
auto description = fds().file_description(fd);
if (!description)
return EBADF;
stat buffer = {};
@ -38,7 +38,7 @@ KResultOr<FlatPtr> Process::sys$stat(Userspace<const Syscall::SC_stat_params*> u
if (params.dirfd == AT_FDCWD) {
base = current_directory();
} else {
auto base_description = file_description(params.dirfd);
auto base_description = fds().file_description(params.dirfd);
if (!base_description)
return EBADF;
if (!base_description->is_directory())