diff options
author | Hendiadyoin1 <leon2002.la@gmail.com> | 2021-12-18 18:39:18 +0100 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2021-12-18 10:31:18 -0800 |
commit | f38d32535c44069b4681e2d1a8b484e98dd5ab28 (patch) | |
tree | 25cd5566090309a9b28ae7a02f66c98a7d09a956 /Kernel | |
parent | c860e0ab9541c430fcbb48c39fcb8f487d5894ac (diff) | |
download | serenity-f38d32535c44069b4681e2d1a8b484e98dd5ab28.zip |
Kernel: Access OpenFileDescriptions::max_open() statically in Syscalls
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/Syscalls/dup2.cpp | 2 | ||||
-rw-r--r-- | Kernel/Syscalls/pipe.cpp | 2 | ||||
-rw-r--r-- | Kernel/Syscalls/poll.cpp | 2 | ||||
-rw-r--r-- | Kernel/Syscalls/sysconf.cpp | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/Kernel/Syscalls/dup2.cpp b/Kernel/Syscalls/dup2.cpp index ed0c8e74d0..2d082431cd 100644 --- a/Kernel/Syscalls/dup2.cpp +++ b/Kernel/Syscalls/dup2.cpp @@ -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(); diff --git a/Kernel/Syscalls/pipe.cpp b/Kernel/Syscalls/pipe.cpp index e517bf2d72..e090e028d0 100644 --- a/Kernel/Syscalls/pipe.cpp +++ b/Kernel/Syscalls/pipe.cpp @@ -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) diff --git a/Kernel/Syscalls/poll.cpp b/Kernel/Syscalls/poll.cpp index 6b914cdc8c..670a1fa2a7 100644 --- a/Kernel/Syscalls/poll.cpp +++ b/Kernel/Syscalls/poll.cpp @@ -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; diff --git a/Kernel/Syscalls/sysconf.cpp b/Kernel/Syscalls/sysconf.cpp index ebe8b0e54b..6f9c562650 100644 --- a/Kernel/Syscalls/sysconf.cpp +++ b/Kernel/Syscalls/sysconf.cpp @@ -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: |