mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
Merge pull request #43 from wnsntgs/Kernel/Sched/NanosleepTimerFix
Fix timer cleanup in interrupted nanosleep
This commit is contained in:
@@ -32,11 +32,13 @@ syscallret_t syscall_nanosleep(context_t *, timespec_t *utime, timespec_t *remai
|
|||||||
|
|
||||||
ret.errno = sched_yield() == SCHED_WAKEUP_REASON_INTERRUPTED ? EINTR : 0;
|
ret.errno = sched_yield() == SCHED_WAKEUP_REASON_INTERRUPTED ? EINTR : 0;
|
||||||
|
|
||||||
if (ret.errno && remaining) {
|
if (ret.errno) {
|
||||||
uintmax_t remainingus = timer_remove(current_cpu()->timer, &sleepentry);
|
uintmax_t remainingus = timer_remove(current_cpu()->timer, &sleepentry);
|
||||||
time.ns = (remainingus % 1000000) * 1000;
|
if (remaining) {
|
||||||
time.s = (remainingus / 1000000);
|
time.ns = (remainingus % 1000000) * 1000;
|
||||||
ret.errno = usercopy_touser(remaining, &time, sizeof(timespec_t)) ? EFAULT : EINTR;
|
time.s = (remainingus / 1000000);
|
||||||
|
ret.errno = usercopy_touser(remaining, &time, sizeof(timespec_t)) ? EFAULT : EINTR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sched_target_cpu(NULL);
|
sched_target_cpu(NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user