From 85f1e2e1cf095cd8ff1f54cb9fb71be4ee608bf9 Mon Sep 17 00:00:00 2001 From: Nicolas Dusart Date: Wed, 12 Jul 2017 15:41:58 +0200 Subject: [PATCH] add poll module for all platforms --- Cargo.toml | 2 +- src/lib.rs | 3 +-- src/poll.rs | 6 +++--- test/test.rs | 1 - 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 64a212f64c..3eceb8e71e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ preadv_pwritev = [] signalfd = [] [dependencies] -libc = "0.2.25" +libc = { git = "https://github.com/rust-lang/libc" } bitflags = "0.9" cfg-if = "0.1.0" void = "1.0.2" diff --git a/src/lib.rs b/src/lib.rs index f0cdb581ee..eee0f2de9f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -46,7 +46,6 @@ pub mod mqueue; pub mod pty; -#[cfg(any(target_os = "linux", target_os = "macos"))] pub mod poll; pub mod net; @@ -96,7 +95,7 @@ pub enum Error { /// The operation involved a conversion to Rust's native String type, which failed because the /// string did not contain all valid UTF-8. InvalidUtf8, - /// The operation is not supported by Nix, in this instance either use the libc bindings or + /// The operation is not supported by Nix, in this instance either use the libc bindings or /// consult the module documentation to see if there is a more appropriate interface available. UnsupportedOperation, } diff --git a/src/poll.rs b/src/poll.rs index afc5bd9c95..81cb8bd6d1 100644 --- a/src/poll.rs +++ b/src/poll.rs @@ -1,6 +1,6 @@ -#[cfg(any(target_os = "linux", target_os = "android"))] +#[cfg(any(target_os = "linux", target_os = "android", target_os = "freebsd", target_os = "dragonfly"))] use sys::time::TimeSpec; -#[cfg(any(target_os = "linux", target_os = "android"))] +#[cfg(any(target_os = "linux", target_os = "android", target_os = "freebsd", target_os = "dragonfly"))] use sys::signal::SigSet; use libc; @@ -53,7 +53,7 @@ pub fn poll(fds: &mut [PollFd], timeout: libc::c_int) -> Result { Errno::result(res) } -#[cfg(any(target_os = "linux", target_os = "android"))] +#[cfg(any(target_os = "linux", target_os = "android", target_os = "freebsd", target_os = "dragonfly"))] pub fn ppoll(fds: &mut [PollFd], timeout: TimeSpec, sigmask: SigSet) -> Result { diff --git a/test/test.rs b/test/test.rs index 2cf3036054..2791e9354d 100644 --- a/test/test.rs +++ b/test/test.rs @@ -15,7 +15,6 @@ mod test_fcntl; mod test_mq; mod test_net; mod test_nix_path; -#[cfg(any(target_os = "linux", target_os = "macos"))] mod test_poll; mod test_pty; #[cfg(any(target_os = "linux", target_os = "android"))]