Skip to content
Snippets Groups Projects
Verified Commit 0ea2b5d4 authored by Jacob Lorentzon's avatar Jacob Lorentzon
Browse files

Fix compilation on Linux.

parent 3db425fe
No related branches found
No related tags found
No related merge requests found
use alloc::vec::Vec;
use generic_rt::GenericTcb;
use syscall::Sigcontrol;
use core::{arch::asm, cell::UnsafeCell, mem, ops::{Deref, DerefMut}, ptr, slice, sync::atomic::AtomicBool};
use goblin::error::{Error, Result};
......
......@@ -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 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment