mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
Kernel: Make OpenFileDescriptions::max_open() static and constexpr
This method was just returning a static constexpr member variable verbatim, so there's no point requiring a member function to observe its value.
This commit is contained in:
parent
fff265a9a9
commit
bc29c7f04f
Notes:
sideshowbarker
2024-07-18 01:06:54 +09:00
Author: https://github.com/ADKaster
Commit: bc29c7f04f
Pull-request: https://github.com/SerenityOS/serenity/pull/10737
Reviewed-by: https://github.com/BenWiederhake
Reviewed-by: https://github.com/PeterBindels-TomTom
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/dascandy
Reviewed-by: https://github.com/trflynn89
2 changed files with 4 additions and 4 deletions
|
@ -151,7 +151,7 @@ ErrorOr<NonnullRefPtr<Process>> Process::try_create_user_process(RefPtr<Thread>&
|
||||||
auto name = TRY(KString::try_create(parts.last()));
|
auto name = TRY(KString::try_create(parts.last()));
|
||||||
auto process = TRY(Process::try_create(first_thread, move(name), uid, gid, ProcessID(0), false, VirtualFileSystem::the().root_custody(), nullptr, tty));
|
auto process = TRY(Process::try_create(first_thread, move(name), uid, gid, ProcessID(0), false, VirtualFileSystem::the().root_custody(), nullptr, tty));
|
||||||
|
|
||||||
TRY(process->m_fds.try_resize(process->m_fds.max_open()));
|
TRY(process->m_fds.try_resize(Process::OpenFileDescriptions::max_open()));
|
||||||
|
|
||||||
auto& device_to_use_as_tty = tty ? (CharacterDevice&)*tty : DeviceManagement::the().null_device();
|
auto& device_to_use_as_tty = tty ? (CharacterDevice&)*tty : DeviceManagement::the().null_device();
|
||||||
auto description = TRY(device_to_use_as_tty.open(O_RDWR));
|
auto description = TRY(device_to_use_as_tty.open(O_RDWR));
|
||||||
|
|
|
@ -663,9 +663,9 @@ public:
|
||||||
|
|
||||||
ErrorOr<void> try_resize(size_t size) { return m_fds_metadatas.try_resize(size); }
|
ErrorOr<void> try_resize(size_t size) { return m_fds_metadatas.try_resize(size); }
|
||||||
|
|
||||||
size_t max_open() const
|
static constexpr size_t max_open()
|
||||||
{
|
{
|
||||||
return m_max_open_file_descriptors;
|
return s_max_open_file_descriptors;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear()
|
void clear()
|
||||||
|
@ -678,7 +678,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OpenFileDescriptions() = default;
|
OpenFileDescriptions() = default;
|
||||||
static constexpr size_t m_max_open_file_descriptors { FD_SETSIZE };
|
static constexpr size_t s_max_open_file_descriptors { FD_SETSIZE };
|
||||||
mutable Spinlock m_fds_lock;
|
mutable Spinlock m_fds_lock;
|
||||||
Vector<OpenFileDescriptionAndFlags> m_fds_metadatas;
|
Vector<OpenFileDescriptionAndFlags> m_fds_metadatas;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue