mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 18:15:07 +00:00
Kernel: Make Process::FileDescriptions::allocate return KResultOr<int>
Modernize more error checking by utilizing KResultOr.
This commit is contained in:
parent
d2cee9cbf6
commit
ba03b6ad02
10 changed files with 48 additions and 37 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue