diff options
author | Brian Gianforcaro <bgianf@serenityos.org> | 2021-07-27 02:12:51 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-28 19:07:00 +0200 |
commit | ba03b6ad020b48040b64aed7c9fb1cc8b7bbda7b (patch) | |
tree | 23aaab1f29251f2efcbb2c3f468420f078259fd5 /Kernel/Process.cpp | |
parent | d2cee9cbf69aa43a92b41c6fb76110273cb7c82e (diff) | |
download | serenity-ba03b6ad020b48040b64aed7c9fb1cc8b7bbda7b.zip |
Kernel: Make Process::FileDescriptions::allocate return KResultOr<int>
Modernize more error checking by utilizing KResultOr.
Diffstat (limited to 'Kernel/Process.cpp')
-rw-r--r-- | Kernel/Process.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index d83c7470d2..4ce3f826af 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -465,14 +465,14 @@ size_t Process::FileDescriptions::open_count() const return count; } -int Process::FileDescriptions::allocate(int first_candidate_fd) +KResultOr<int> Process::FileDescriptions::allocate(int first_candidate_fd) { ScopedSpinLock lock(m_fds_lock); for (size_t i = first_candidate_fd; i < max_open(); ++i) { if (!m_fds_metadatas[i]) return i; } - return -EMFILE; + return KResult(EMFILE); } Time kgettimeofday() |