kernel: Retrieve all thread information before marking it as dead in waitpid()
All checks were successful
continuous-integration/drone/push Build is passing

In case we get interrupted by the reaper thread.
This commit is contained in:
apio 2023-03-24 20:59:07 +01:00
parent 54a4ebe5bb
commit 4d3050eaab
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -43,11 +43,12 @@ Result<u64> sys_waitpid(Registers*, SyscallArgs args)
return err(ENOTSUP);
int status = (int)thread->status;
u64 id = thread->id;
thread->state = ThreadState::Dying;
if (status_ptr)
if (!MemoryManager::copy_to_user_typed(status_ptr, &status)) return err(EFAULT);
return thread->id;
return id;
}