Kernel: If a process is interrupted during usleep(), return -EINTR

This commit is contained in:
Andreas Kling 2019-11-06 21:01:44 +01:00
parent ac2cc7d78f
commit 2c693094d9
Notes: sideshowbarker 2024-07-19 11:20:37 +09:00

View file

@ -1514,12 +1514,9 @@ int Process::sys$usleep(useconds_t usec)
{
if (!usec)
return 0;
u64 wakeup_time = current->sleep(usec / 1000);
if (wakeup_time > g_uptime) {
u32 ticks_left_until_original_wakeup_time = wakeup_time - g_uptime;
return ticks_left_until_original_wakeup_time / TICKS_PER_SECOND;
}
if (wakeup_time > g_uptime)
return -EINTR;
return 0;
}