mirror of
https://github.com/hexagonal-sun/moss-kernel.git
synced 2026-04-19 22:58:11 -04:00
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:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user