diff options
author | Liav A <liavalb@gmail.com> | 2021-06-22 21:22:17 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-29 20:53:59 +0200 |
commit | 7c87891c06e37f217b5fde17a3fc869306da659b (patch) | |
tree | 3017e40cfb6fbbd01e1f0b36b483003d498c189c /Kernel/Syscalls/open.cpp | |
parent | 12b6e6915034a0c0d1981caf419a35c0a8cd247e (diff) | |
download | serenity-7c87891c06e37f217b5fde17a3fc869306da659b.zip |
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.
Diffstat (limited to 'Kernel/Syscalls/open.cpp')
-rw-r--r-- | Kernel/Syscalls/open.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Kernel/Syscalls/open.cpp b/Kernel/Syscalls/open.cpp index 4df12ef4a7..5ab765653c 100644 --- a/Kernel/Syscalls/open.cpp +++ b/Kernel/Syscalls/open.cpp @@ -44,7 +44,7 @@ KResultOr<FlatPtr> Process::sys$open(Userspace<const Syscall::SC_open_params*> u return path.error(); dbgln_if(IO_DEBUG, "sys$open(dirfd={}, path='{}', options={}, mode={})", dirfd, path.value()->view(), options, mode); - int fd = alloc_fd(); + int fd = m_fds.allocate(); if (fd < 0) return fd; @@ -52,7 +52,7 @@ KResultOr<FlatPtr> Process::sys$open(Userspace<const Syscall::SC_open_params*> u if (dirfd == AT_FDCWD) { base = current_directory(); } else { - auto base_description = file_description(dirfd); + auto base_description = fds().file_description(dirfd); if (!base_description) return EBADF; if (!base_description->is_directory()) @@ -78,7 +78,7 @@ KResultOr<FlatPtr> Process::sys$open(Userspace<const Syscall::SC_open_params*> u KResultOr<FlatPtr> Process::sys$close(int fd) { REQUIRE_PROMISE(stdio); - auto description = file_description(fd); + auto description = fds().file_description(fd); dbgln_if(IO_DEBUG, "sys$close({}) {}", fd, description.ptr()); if (!description) return EBADF; |