syscalls: wait4: make interruptable()

Make the `sys_wait4` system call interruptable via signal delivery.

Also include some a test in `usertest` to ensure proper functionality.
This commit is contained in:
Matthew Leach
2026-01-16 20:14:28 +00:00
parent ecdfd360d1
commit bc5d1cd91e
3 changed files with 61 additions and 6 deletions

View File

@@ -1,3 +1,7 @@
use super::{
Pgid, Tgid, ThreadGroup,
signal::{InterruptResult, Interruptable, SigId},
};
use crate::clock::timespec::TimeSpec;
use crate::memory::uaccess::copy_to_user;
use crate::sched::current::current_task_shared;
@@ -10,10 +14,6 @@ use libkernel::{
memory::address::TUA,
};
use super::Tgid;
use super::signal::SigId;
use super::{Pgid, ThreadGroup};
pub type PidT = i32;
#[repr(C)]
@@ -201,11 +201,17 @@ pub async fn sys_wait4(
None => return Ok(0),
}
} else {
task.process
match task
.process
.child_notifiers
.inner
.wait_until(|state| do_wait(state, pid, flags))
.interruptable()
.await
{
InterruptResult::Interrupted => return Err(KernelError::Interrupted),
InterruptResult::Uninterrupted(r) => r,
}
};
if !stat_addr.is_null() {