From e94c139a47055d3492d6ccccfce4acbcba9d7391 Mon Sep 17 00:00:00 2001 From: Xavier L'Heureux Date: Tue, 16 Jul 2019 15:02:54 -0400 Subject: Remove more unsupported functions and make it possible to run tests --- src/sys/signal.rs | 22 +++++++++++----------- src/sys/stat.rs | 1 + 2 files changed, 12 insertions(+), 11 deletions(-) (limited to 'src/sys') diff --git a/src/sys/signal.rs b/src/sys/signal.rs index ad5cc031..b49a9f53 100644 --- a/src/sys/signal.rs +++ b/src/sys/signal.rs @@ -464,6 +464,7 @@ impl SigSet { /// Suspends execution of the calling thread until one of the signals in the /// signal mask becomes pending, and returns the accepted signal. + #[cfg(not(target_os = "redox"))] pub fn wait(&self) -> Result { let mut signum = mem::MaybeUninit::uninit(); let res = unsafe { libc::sigwait(&self.sigset as *const libc::sigset_t, signum.as_mut_ptr()) }; @@ -890,6 +891,7 @@ mod sigevent { #[cfg(test)] mod tests { + #[cfg(not(target_os = "redox"))] use std::thread; use super::*; @@ -945,6 +947,7 @@ mod tests { } #[test] + #[cfg(not(target_os = "redox"))] fn test_thread_signal_set_mask() { thread::spawn(|| { let prev_mask = SigSet::thread_get_mask() @@ -965,6 +968,7 @@ mod tests { } #[test] + #[cfg(not(target_os = "redox"))] fn test_thread_signal_block() { thread::spawn(|| { let mut mask = SigSet::empty(); @@ -977,6 +981,7 @@ mod tests { } #[test] + #[cfg(not(target_os = "redox"))] fn test_thread_signal_unblock() { thread::spawn(|| { let mut mask = SigSet::empty(); @@ -989,6 +994,7 @@ mod tests { } #[test] + #[cfg(not(target_os = "redox"))] fn test_thread_signal_swap() { thread::spawn(|| { let mut mask = SigSet::empty(); @@ -1011,23 +1017,14 @@ mod tests { } #[test] + #[cfg(not(target_os = "redox"))] fn test_sigaction() { use libc; thread::spawn(|| { extern fn test_sigaction_handler(_: libc::c_int) {} - #[cfg(not(target_os = "redox"))] extern fn test_sigaction_action(_: libc::c_int, _: *mut libc::siginfo_t, _: *mut libc::c_void) {} - #[cfg(not(target_os = "redox"))] - fn test_sigaction_sigaction(flags: SaFlags, mask: SigSet) { - let handler_act = SigHandler::SigAction(test_sigaction_action); - let action_act = SigAction::new(handler_act, flags, mask); - assert_eq!(action_act.handler(), handler_act); - } - #[cfg(target_os = "redox")] - fn test_sigaction_sigaction() {} - let handler_sig = SigHandler::Handler(test_sigaction_handler); let flags = SaFlags::SA_ONSTACK | SaFlags::SA_RESTART | @@ -1046,7 +1043,9 @@ mod tests { assert!(mask.contains(SIGUSR1)); assert!(!mask.contains(SIGUSR2)); - test_sigaction_sigaction(flags, mask); + let handler_act = SigHandler::SigAction(test_sigaction_action); + let action_act = SigAction::new(handler_act, flags, mask); + assert_eq!(action_act.handler(), handler_act); let action_dfl = SigAction::new(SigHandler::SigDfl, flags, mask); assert_eq!(action_dfl.handler(), SigHandler::SigDfl); @@ -1057,6 +1056,7 @@ mod tests { } #[test] + #[cfg(not(target_os = "redox"))] fn test_sigwait() { thread::spawn(|| { let mut mask = SigSet::empty(); diff --git a/src/sys/stat.rs b/src/sys/stat.rs index 5d426844..f8fae4ee 100644 --- a/src/sys/stat.rs +++ b/src/sys/stat.rs @@ -289,6 +289,7 @@ pub fn utimensat( Errno::result(res).map(drop) } +#[cfg(not(target_os = "redox"))] pub fn mkdirat(fd: RawFd, path: &P, mode: Mode) -> Result<()> { let res = path.with_nix_path(|cstr| { unsafe { libc::mkdirat(fd, cstr.as_ptr(), mode.bits() as mode_t) } -- cgit v1.2.3