Implement sigsuspend.
This commit is contained in:
@@ -155,8 +155,10 @@ impl PalSignal for Sys {
|
||||
.map(|_| ())
|
||||
}
|
||||
|
||||
fn sigsuspend(set: &sigset_t) -> c_int {
|
||||
unsafe { e(syscall!(RT_SIGSUSPEND, set as *const sigset_t, NSIG / 8)) as c_int }
|
||||
fn sigsuspend(set: &sigset_t) -> Errno {
|
||||
unsafe {
|
||||
e_raw(syscall!(RT_SIGSUSPEND, set as *const sigset_t, NSIG / 8)).expect_err("must fail")
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn sigtimedwait(
|
||||
|
||||
@@ -37,7 +37,7 @@ pub trait PalSignal: Pal {
|
||||
oset: Option<&mut sigset_t>,
|
||||
) -> Result<(), Errno>;
|
||||
|
||||
fn sigsuspend(set: &sigset_t) -> c_int;
|
||||
fn sigsuspend(set: &sigset_t) -> Errno; // always fails
|
||||
|
||||
unsafe fn sigtimedwait(set: *const sigset_t, sig: *mut siginfo_t, tp: *const timespec)
|
||||
-> c_int;
|
||||
|
||||
@@ -246,7 +246,7 @@ impl PalSignal for Sys {
|
||||
}
|
||||
|
||||
fn sigpending(set: &mut sigset_t) -> Result<(), Errno> {
|
||||
*set = redox_rt::signal::currently_pending();
|
||||
*set = redox_rt::signal::currently_pending_blocked();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -264,20 +264,11 @@ impl PalSignal for Sys {
|
||||
})
|
||||
}
|
||||
|
||||
fn sigsuspend(set: &sigset_t) -> c_int {
|
||||
//TODO: correct implementation
|
||||
let mut oset = sigset_t::default();
|
||||
if let Err(err) = redox_rt::signal::set_sigmask(Some(*set), Some(&mut oset)) {
|
||||
Errno::from(err).sync();
|
||||
return -1;
|
||||
fn sigsuspend(set: &sigset_t) -> Errno {
|
||||
match redox_rt::signal::wait_with_mask(*set) {
|
||||
Ok(_) => unreachable!(),
|
||||
Err(err) => err.into(),
|
||||
}
|
||||
//TODO: wait for signal
|
||||
Self::sched_yield();
|
||||
if let Err(err) = redox_rt::signal::set_sigmask(Some(oset), None) {
|
||||
Errno::from(err).sync();
|
||||
return -1;
|
||||
}
|
||||
0
|
||||
}
|
||||
|
||||
unsafe fn sigtimedwait(
|
||||
|
||||
Reference in New Issue
Block a user