Merge pull request #43 from wnsntgs/Kernel/Sched/NanosleepTimerFix

Fix timer cleanup in interrupted nanosleep
This commit is contained in:
Matheus
2026-09-23 15:09:28 -03:00
committed by GitHub
+3 -1
View File
@@ -32,12 +32,14 @@ syscallret_t syscall_nanosleep(context_t *, timespec_t *utime, timespec_t *remai
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);
if (remaining) {
time.ns = (remainingus % 1000000) * 1000;
time.s = (remainingus / 1000000);
ret.errno = usercopy_touser(remaining, &time, sizeof(timespec_t)) ? EFAULT : EINTR;
}
}
sched_target_cpu(NULL);