summaryrefslogtreecommitdiff
path: root/Kernel/Process.cpp
diff options
context:
space:
mode:
authorBrian Gianforcaro <bgianf@serenityos.org>2021-07-27 02:12:51 -0700
committerAndreas Kling <kling@serenityos.org>2021-07-28 19:07:00 +0200
commitba03b6ad020b48040b64aed7c9fb1cc8b7bbda7b (patch)
tree23aaab1f29251f2efcbb2c3f468420f078259fd5 /Kernel/Process.cpp
parentd2cee9cbf69aa43a92b41c6fb76110273cb7c82e (diff)
downloadserenity-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.cpp4
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()