Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fuchsia-zircon = "0.3.2"
fuchsia-zircon-sys = "0.3.2"

[target.'cfg(unix)'.dependencies]
libc = "0.2.42"
libc = "0.2.54"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pfmooney I assume this is a sufficient up-to-date version, I didn't manually check this.


[target.'cfg(windows)'.dependencies]
winapi = "0.2.6"
Expand Down
14 changes: 12 additions & 2 deletions src/sys/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,20 @@ use libc::{self, c_int};
#[macro_use]
pub mod dlsym;

#[cfg(any(target_os = "linux", target_os = "android", target_os = "solaris"))]
#[cfg(any(
target_os = "android",
target_os = "illumos",
target_os = "linux",
target_os = "solaris"
))]
mod epoll;

#[cfg(any(target_os = "linux", target_os = "android", target_os = "solaris"))]
#[cfg(any(
target_os = "android",
target_os = "illumos",
target_os = "linux",
target_os = "solaris"
))]
pub use self::epoll::{Events, Selector};

#[cfg(any(target_os = "bitrig", target_os = "dragonfly",
Expand Down
45 changes: 36 additions & 9 deletions src/sys/unix/ready.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,20 @@ const LIO: usize = 0b10_0000;
#[cfg(not(any(target_os = "freebsd")))]
const LIO: usize = 0b00_0000;

#[cfg(any(target_os = "linux", target_os = "android", target_os = "solaris"))]
#[cfg(any(
target_os = "android",
target_os = "illumos",
target_os = "linux",
target_os = "solaris"
))]
const PRI: usize = 0b100_0000;

#[cfg(not(any(target_os = "linux", target_os = "android", target_os = "solaris")))]
#[cfg(not(any(
target_os = "android",
target_os = "illumos",
target_os = "linux",
target_os = "solaris"
)))]
const PRI: usize = 0;

// Export to support `Ready::all`
Expand All @@ -129,7 +139,12 @@ fn test_ready_all() {
);

// Issue #896.
#[cfg(any(target_os = "linux", target_os = "android", target_os = "solaris"))]
#[cfg(any(
target_os = "android",
target_os = "illumos",
target_os = "linux",
target_os = "solaris"
))]
assert!(!Ready::from(UnixReady::priority()).is_writable());
}

Expand Down Expand Up @@ -258,8 +273,12 @@ impl UnixReady {
///
/// [`Poll`]: struct.Poll.html
#[inline]
#[cfg(any(target_os = "linux",
target_os = "android", target_os = "solaris"))]
#[cfg(any(
target_os = "android",
target_os = "illumos",
target_os = "linux",
target_os = "solaris"
))]
pub fn priority() -> UnixReady {
UnixReady(ready_from_usize(PRI))
}
Expand Down Expand Up @@ -385,8 +404,12 @@ impl UnixReady {
///
/// [`Poll`]: struct.Poll.html
#[inline]
#[cfg(any(target_os = "linux",
target_os = "android", target_os = "solaris"))]
#[cfg(any(
target_os = "android",
target_os = "illumos",
target_os = "linux",
target_os = "solaris"
))]
pub fn is_priority(&self) -> bool {
self.contains(ready_from_usize(PRI))
}
Expand Down Expand Up @@ -476,8 +499,12 @@ impl fmt::Debug for UnixReady {
(UnixReady::hup(), "Hup"),
#[allow(deprecated)]
(UnixReady::aio(), "Aio"),
#[cfg(any(target_os = "linux",
target_os = "android", target_os = "solaris"))]
#[cfg(any(
target_os = "android",
target_os = "illumos",
target_os = "linux",
target_os = "solaris"
))]
(UnixReady::priority(), "Priority"),
];

Expand Down
26 changes: 20 additions & 6 deletions test/test_tcp_shutdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,16 @@ fn test_graceful_shutdown() {
drop(socket);

assert_ready!(poll, Token(0), Ready::readable());
#[cfg(not(any(target_os = "bitrig", target_os = "dragonfly",
target_os = "freebsd", target_os = "ios", target_os = "macos",
target_os = "netbsd", target_os = "openbsd")))]
#[cfg(not(any(
target_os = "bitrig",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd"
)))]
assert_hup_ready!(poll);

let mut buf = [0; 1024];
Expand Down Expand Up @@ -236,9 +243,16 @@ fn test_abrupt_shutdown() {

drop(socket);

#[cfg(not(any(target_os = "bitrig", target_os = "dragonfly",
target_os = "freebsd", target_os = "ios", target_os = "macos",
target_os = "netbsd", target_os = "openbsd")))]
#[cfg(not(any(
target_os = "bitrig",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd"
)))]
assert_hup_ready!(poll);
assert_ready!(poll, Token(0), Ready::writable());
assert_ready!(poll, Token(0), Ready::readable());
Expand Down