mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:28:11 +00:00
Kernel: Modify TimeManagement::current_time(..) API so it can't fail. (#6869)
The fact that current_time can "fail" makes its use a bit awkward. All callers in the Kernel are trusted besides syscalls, so assert that they never get there, and make sure all current callers perform validation of the clock_id with TimeManagement::is_valid_clock_id(). I have fuzzed this change locally for a bit to make sure I didn't miss any obvious regression.
This commit is contained in:
parent
64b4e3f34b
commit
11306d7121
6 changed files with 14 additions and 13 deletions
|
@ -23,7 +23,7 @@ Thread::BlockTimeout::BlockTimeout(bool is_absolute, const Time* time, const Tim
|
|||
m_time = *time;
|
||||
m_should_block = true;
|
||||
}
|
||||
m_start_time = start_time ? *start_time : TimeManagement::the().current_time(clock_id).value();
|
||||
m_start_time = start_time ? *start_time : TimeManagement::the().current_time(clock_id);
|
||||
if (!is_absolute)
|
||||
m_time += m_start_time;
|
||||
}
|
||||
|
@ -326,7 +326,7 @@ void Thread::SleepBlocker::calculate_remaining()
|
|||
{
|
||||
if (!m_remaining)
|
||||
return;
|
||||
auto time_now = TimeManagement::the().current_time(m_deadline.clock_id()).value();
|
||||
auto time_now = TimeManagement::the().current_time(m_deadline.clock_id());
|
||||
if (time_now < m_deadline.absolute_time())
|
||||
*m_remaining = m_deadline.absolute_time() - time_now;
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue