Fix signal support
This commit is contained in:
@@ -54,6 +54,7 @@ pub const SIGPOLL: usize = SIGIO;
|
||||
pub const SIGPWR: usize = 30;
|
||||
pub const SIGSYS: usize = 31;
|
||||
pub const SIGUNUSED: usize = SIGSYS;
|
||||
pub const NSIG: usize = 32;
|
||||
|
||||
pub const SA_NOCLDSTOP: usize = 1;
|
||||
pub const SA_NOCLDWAIT: usize = 2;
|
||||
|
||||
@@ -36,7 +36,6 @@ pub struct sigaction {
|
||||
pub sa_mask: sigset_t,
|
||||
}
|
||||
|
||||
pub const NSIG: usize = 64;
|
||||
pub type sigset_t = c_ulong;
|
||||
|
||||
#[no_mangle]
|
||||
|
||||
@@ -51,6 +51,7 @@ pub const SIGWINCH: usize = 28;
|
||||
pub const SIGIO: usize = 29;
|
||||
pub const SIGPWR: usize = 30;
|
||||
pub const SIGSYS: usize = 31;
|
||||
pub const NSIG: usize = 32;
|
||||
|
||||
pub const SA_NOCLDSTOP: usize = 0x00000001;
|
||||
pub const SA_NOCLDWAIT: usize = 0x00000002;
|
||||
|
||||
@@ -53,17 +53,6 @@ pub extern "C" fn gettimeofday(tp: *mut timeval, tzp: *mut timezone) -> c_int {
|
||||
Sys::gettimeofday(tp, tzp)
|
||||
}
|
||||
|
||||
// #[no_mangle]
|
||||
pub extern "C" fn select(
|
||||
nfds: c_int,
|
||||
readfds: *mut fd_set,
|
||||
writefds: *mut fd_set,
|
||||
errorfds: *mut fd_set,
|
||||
timeout: *mut timeval,
|
||||
) -> c_int {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn utimes(path: *const c_char, times: *const timeval) -> c_int {
|
||||
let path = CStr::from_ptr(path);
|
||||
@@ -79,10 +68,3 @@ pub unsafe extern "C" fn utimes(path: *const c_char, times: *const timeval) -> c
|
||||
];
|
||||
Sys::utimens(path, times_spec.as_ptr())
|
||||
}
|
||||
|
||||
/*
|
||||
#[no_mangle]
|
||||
pub extern "C" fn func(args) -> c_int {
|
||||
unimplemented!();
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -7,7 +7,7 @@ use super::super::{Pal, PalSignal};
|
||||
use super::{e, Sys};
|
||||
use header::errno::EINVAL;
|
||||
use header::signal::{sigaction, sigset_t};
|
||||
use header::sys_time::itimerval;
|
||||
use header::sys_time::{ITIMER_REAL, itimerval};
|
||||
|
||||
impl PalSignal for Sys {
|
||||
fn getitimer(which: c_int, out: *mut itimerval) -> c_int {
|
||||
@@ -20,7 +20,7 @@ impl PalSignal for Sys {
|
||||
};
|
||||
|
||||
let fd = e(syscall::open(path, syscall::O_RDONLY | syscall::O_CLOEXEC));
|
||||
if fd < 0 {
|
||||
if fd == !0 {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ impl PalSignal for Sys {
|
||||
|
||||
let _ = syscall::close(fd);
|
||||
|
||||
if count < 0 {
|
||||
if count == !0 {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ impl PalSignal for Sys {
|
||||
};
|
||||
|
||||
let fd = e(syscall::open(path, syscall::O_RDWR | syscall::O_CLOEXEC));
|
||||
if fd < 0 {
|
||||
if fd == !0 {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ impl PalSignal for Sys {
|
||||
|
||||
let mut count = e(syscall::read(fd, &mut spec));
|
||||
|
||||
if count >= 0 {
|
||||
if count != !0 {
|
||||
unsafe {
|
||||
if ! old.is_null() {
|
||||
(*old).it_interval.tv_sec = spec.it_interval.tv_sec;
|
||||
@@ -93,7 +93,7 @@ impl PalSignal for Sys {
|
||||
|
||||
let _ = syscall::close(fd);
|
||||
|
||||
if count < 0 {
|
||||
if count == !0 {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user