mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-25 09:04:53 +00:00
Kernel: Make Process::FileDescriptions::allocate return KResultOr<int>
Modernize more error checking by utilizing KResultOr.
This commit is contained in:
committed by
Andreas Kling
parent
d2cee9cbf6
commit
ba03b6ad02
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user