mirror of
https://github.com/RGBCube/serenity
synced 2025-07-02 23:12:08 +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:
parent
12b6e69150
commit
7c87891c06
28 changed files with 198 additions and 128 deletions
|
@ -14,7 +14,7 @@ KResultOr<FlatPtr> Process::sys$fcntl(int fd, int cmd, u32 arg)
|
|||
{
|
||||
REQUIRE_PROMISE(stdio);
|
||||
dbgln_if(IO_DEBUG, "sys$fcntl: fd={}, cmd={}, arg={}", fd, cmd, arg);
|
||||
auto description = file_description(fd);
|
||||
auto description = fds().file_description(fd);
|
||||
if (!description)
|
||||
return EBADF;
|
||||
// NOTE: The FD flags are not shared between FileDescription objects.
|
||||
|
@ -24,7 +24,7 @@ KResultOr<FlatPtr> Process::sys$fcntl(int fd, int cmd, u32 arg)
|
|||
int arg_fd = (int)arg;
|
||||
if (arg_fd < 0)
|
||||
return EINVAL;
|
||||
int new_fd = alloc_fd(arg_fd);
|
||||
int new_fd = fds().allocate(arg_fd);
|
||||
if (new_fd < 0)
|
||||
return new_fd;
|
||||
m_fds[new_fd].set(*description);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue