1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:57:35 +00:00

Kernel: Access OpenFileDescriptions::max_open() statically in Syscalls

This commit is contained in:
Hendiadyoin1 2021-12-18 18:39:18 +01:00 committed by Brian Gianforcaro
parent c860e0ab95
commit f38d32535c
4 changed files with 4 additions and 4 deletions

View file

@ -16,7 +16,7 @@ ErrorOr<FlatPtr> Process::sys$dup2(int old_fd, int new_fd)
auto description = TRY(fds().open_file_description(old_fd));
if (old_fd == new_fd)
return new_fd;
if (new_fd < 0 || static_cast<size_t>(new_fd) >= fds().max_open())
if (new_fd < 0 || static_cast<size_t>(new_fd) >= OpenFileDescriptions::max_open())
return EINVAL;
if (!m_fds.m_fds_metadatas[new_fd].is_allocated())
m_fds.m_fds_metadatas[new_fd].allocate();

View file

@ -13,7 +13,7 @@ ErrorOr<FlatPtr> Process::sys$pipe(int pipefd[2], int flags)
{
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
REQUIRE_PROMISE(stdio);
if (fds().open_count() + 2 > fds().max_open())
if (fds().open_count() + 2 > OpenFileDescriptions::max_open())
return EMFILE;
// Reject flags other than O_CLOEXEC, O_NONBLOCK
if ((flags & (O_CLOEXEC | O_NONBLOCK)) != flags)

View file

@ -20,7 +20,7 @@ ErrorOr<FlatPtr> Process::sys$poll(Userspace<const Syscall::SC_poll_params*> use
REQUIRE_PROMISE(stdio);
auto params = TRY(copy_typed_from_user(user_params));
if (params.nfds >= fds().max_open())
if (params.nfds >= OpenFileDescriptions::max_open())
return ENOBUFS;
Thread::BlockTimeout timeout;

View file

@ -19,7 +19,7 @@ ErrorOr<FlatPtr> Process::sys$sysconf(int name)
case _SC_NPROCESSORS_ONLN:
return Processor::processor_count();
case _SC_OPEN_MAX:
return fds().max_open();
return OpenFileDescriptions::max_open();
case _SC_PAGESIZE:
return PAGE_SIZE;
case _SC_HOST_NAME_MAX: