mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:57:35 +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
|
@ -25,7 +25,7 @@ KResultOr<unsigned> Process::sys$alarm(unsigned seconds)
|
|||
}
|
||||
|
||||
if (seconds > 0) {
|
||||
auto deadline = TimeManagement::the().current_time(CLOCK_REALTIME_COARSE).value();
|
||||
auto deadline = TimeManagement::the().current_time(CLOCK_REALTIME_COARSE);
|
||||
deadline = deadline + Time::from_seconds(seconds);
|
||||
m_alarm_timer = TimerQueue::the().add_timer_without_id(CLOCK_REALTIME_COARSE, deadline, [this]() {
|
||||
[[maybe_unused]] auto rc = send_signal(SIGALRM, nullptr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue