Fix compilation on Linux.

This commit is contained in:
4lDO2
2024-06-24 11:00:28 +02:00
parent 3db425fef6
commit 0ea2b5d45f
2 changed files with 15 additions and 13 deletions
+15 -12
View File
@@ -2,13 +2,14 @@ use core::mem;
use super::{
super::{types::*, PalSignal},
e, Sys,
e, e_raw, Sys,
};
use crate::header::{
signal::{sigaction, siginfo_t, sigset_t, stack_t, NSIG},
sys_time::itimerval,
time::timespec,
};
use crate::pthread::Errno;
impl PalSignal for Sys {
unsafe fn getitimer(which: c_int, out: *mut itimerval) -> c_int {
@@ -36,8 +37,8 @@ impl PalSignal for Sys {
e(syscall!(SETITIMER, which, new, old)) as c_int
}
fn sigaction(sig: c_int, act: Option<&sigaction>, oact: Option<&mut sigaction>) -> c_int {
e(unsafe {
fn sigaction(sig: c_int, act: Option<&sigaction>, oact: Option<&mut sigaction>) -> Result<(), Errno> {
e_raw(unsafe {
syscall!(
RT_SIGACTION,
sig,
@@ -45,7 +46,7 @@ impl PalSignal for Sys {
oact.map_or_else(core::ptr::null_mut, |x| x as *mut _),
mem::size_of::<sigset_t>()
)
}) as c_int
}).map(|_| ())
}
unsafe fn sigaltstack(ss: *const stack_t, old_ss: *mut stack_t) -> c_int {
@@ -56,14 +57,16 @@ impl PalSignal for Sys {
e(syscall!(RT_SIGPENDING, set, NSIG / 8)) as c_int
}
unsafe fn sigprocmask(how: c_int, set: *const sigset_t, oset: *mut sigset_t) -> c_int {
e(syscall!(
RT_SIGPROCMASK,
how,
set,
oset,
mem::size_of::<sigset_t>()
)) as c_int
fn sigprocmask(how: c_int, set: Option<&sigset_t>, oset: Option<&mut sigset_t>) -> Result<(), Errno> {
e_raw(unsafe {
syscall!(
RT_SIGPROCMASK,
how,
set.map_or_else(core::ptr::null, |x| x as *const _),
oset.map_or_else(core::ptr::null_mut, |x| x as *mut _),
mem::size_of::<sigset_t>()
)
}).map(|_| ())
}
unsafe fn sigsuspend(set: *const sigset_t) -> c_int {