#[cfg(not(target_arch = "riscv64"))]
use crate::arch;
use rustix::io;
pub use rustix::runtime::{
KernelSigaction as Sigaction, KernelSigactionFlags as SigactionFlags, Siginfo, Signal,
};
pub type Sighandler = rustix::runtime::KernelSighandler;
pub unsafe fn sigaction(sig: Signal, action: Option<Sigaction>) -> io::Result<Sigaction> {
unsafe {
#[allow(unused_mut)]
let mut action = action;
#[cfg(not(target_arch = "riscv64"))]
if let Some(action) = &mut action {
action.sa_flags |= SigactionFlags::RESTORER;
if action.sa_flags.contains(SigactionFlags::SIGINFO) {
action.sa_restorer = Some(arch::return_from_signal_handler);
} else {
action.sa_restorer = Some(arch::return_from_signal_handler_noinfo);
}
}
rustix::runtime::kernel_sigaction(sig, action)
}
}
#[doc(alias = "SIG_IGN")]
#[must_use]
pub const fn sig_ign() -> Sighandler {
rustix::runtime::kernel_sig_ign()
}
pub use rustix::runtime::KERNEL_SIG_DFL as SIG_DFL;
pub const SIGSTKSZ: usize = linux_raw_sys::general::SIGSTKSZ as usize;
pub const SS_DISABLE: i32 = linux_raw_sys::general::SS_DISABLE as i32;