From d1e3b41ee0c02149aa1e39f1de32d82f9e97374e Mon Sep 17 00:00:00 2001 From: Thomas de Zeeuw Date: Sun, 7 Nov 2021 11:19:09 +0100 Subject: [PATCH] Remove cfg attributes for Solaris We never really supported Solaris, we pretended it implemented epoll, but it never did see https://github.com/tokio-rs/mio/issues/1152. As no one ever committed to being a maintainer for the port I'm removing it now with this commit. Instead replace it with illumuos on the CI, which we do support (as it supports epoll) and for which we do have maintainers. --- Cargo.toml | 2 +- Makefile | 2 +- ci/azure-cross-compile.yml | 4 ++-- src/poll.rs | 7 +++---- src/sys/unix/net.rs | 7 +++---- src/sys/unix/pipe.rs | 3 +-- src/sys/unix/selector/epoll.rs | 2 +- src/sys/unix/selector/mod.rs | 14 ++------------ src/sys/unix/tcp.rs | 1 - src/sys/unix/uds/listener.rs | 2 -- src/sys/unix/uds/mod.rs | 6 +++--- src/sys/unix/waker.rs | 2 -- tests/tcp_stream.rs | 7 +------ 13 files changed, 18 insertions(+), 41 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 15ab7adfe..eebf857e4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,9 +62,9 @@ targets = [ "aarch64-linux-android", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", - "x86_64-pc-solaris", "x86_64-unknown-dragonfly", "x86_64-unknown-freebsd", + "x86_64-unknown-illumos", "x86_64-unknown-linux-gnu", "x86_64-unknown-netbsd", "x86_64-unknown-openbsd", diff --git a/Makefile b/Makefile index 8f797612c..d46c20b72 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # Targets available via Rustup that are supported. -TARGETS ?= "aarch64-apple-ios" "aarch64-linux-android" "x86_64-apple-darwin" "x86_64-pc-windows-msvc" "x86_64-pc-solaris" "x86_64-unknown-freebsd" "x86_64-unknown-linux-gnu" "x86_64-unknown-netbsd" +TARGETS ?= "aarch64-apple-ios" "aarch64-linux-android" "x86_64-apple-darwin" "x86_64-pc-windows-msvc" "x86_64-unknown-freebsd" "x86_64-unknown-illumos" "x86_64-unknown-linux-gnu" "x86_64-unknown-netbsd" test: cargo test --all-features diff --git a/ci/azure-cross-compile.yml b/ci/azure-cross-compile.yml index 0c3372707..fb62cc437 100644 --- a/ci/azure-cross-compile.yml +++ b/ci/azure-cross-compile.yml @@ -30,9 +30,9 @@ jobs: vmImage: ubuntu-18.04 target: x86_64-unknown-netbsd - Solaris: + illumos: vmImage: ubuntu-18.04 - target: x86_64-pc-solaris + target: x86_64-unknown-illumos pool: vmImage: $(vmImage) diff --git a/src/poll.rs b/src/poll.rs index 62e82cce4..bae88ad6b 100644 --- a/src/poll.rs +++ b/src/poll.rs @@ -172,13 +172,12 @@ use std::{fmt, io}; /// | Android | [epoll] | /// | DragonFly BSD | [kqueue] | /// | FreeBSD | [kqueue] | +/// | iOS | [kqueue] | +/// | illumos | [epoll] | /// | Linux | [epoll] | /// | NetBSD | [kqueue] | /// | OpenBSD | [kqueue] | -/// | Solaris | [epoll] | -/// | illumos | [epoll] | /// | Windows | [IOCP] | -/// | iOS | [kqueue] | /// | macOS | [kqueue] | /// /// On all supported platforms, socket operations are handled by using the @@ -382,7 +381,7 @@ impl Registry { /// /// # Arguments /// - /// `source: &S: event::Source`: This is the source of events that the + /// `source: &mut S: event::Source`: This is the source of events that the /// `Poll` instance should monitor for readiness state changes. /// /// `token: Token`: The caller picks a token to associate with the socket. diff --git a/src/sys/unix/net.rs b/src/sys/unix/net.rs index 2f8d618c0..78f1387b1 100644 --- a/src/sys/unix/net.rs +++ b/src/sys/unix/net.rs @@ -41,9 +41,8 @@ pub(crate) fn new_socket(domain: libc::c_int, socket_type: libc::c_int) -> io::R .map(|_| socket) }); - // Darwin doesn't have SOCK_NONBLOCK or SOCK_CLOEXEC. Not sure about - // Solaris, couldn't find anything online. - #[cfg(any(target_os = "ios", target_os = "macos", target_os = "solaris"))] + // Darwin doesn't have SOCK_NONBLOCK or SOCK_CLOEXEC. + #[cfg(any(target_os = "ios", target_os = "macos"))] let socket = socket.and_then(|socket| { // For platforms that don't support flags in socket, we need to // set the flags ourselves. @@ -124,7 +123,7 @@ pub(crate) fn socket_addr(addr: &SocketAddr) -> (SocketAddrCRepr, libc::socklen_ target_os = "openbsd" ))] sin6_len: 0, - #[cfg(any(target_os = "solaris", target_os = "illumos"))] + #[cfg(target_os = "illumos")] __sin6_src_id: 0, }; diff --git a/src/sys/unix/pipe.rs b/src/sys/unix/pipe.rs index ccf5252d5..c899dfb2d 100644 --- a/src/sys/unix/pipe.rs +++ b/src/sys/unix/pipe.rs @@ -162,7 +162,7 @@ pub fn new() -> io::Result<(Sender, Receiver)> { } } - #[cfg(any(target_os = "ios", target_os = "macos", target_os = "solaris"))] + #[cfg(any(target_os = "ios", target_os = "macos"))] unsafe { // For platforms that don't have `pipe2(2)` we need to manually set the // correct flags on the file descriptor. @@ -192,7 +192,6 @@ pub fn new() -> io::Result<(Sender, Receiver)> { target_os = "openbsd", target_os = "ios", target_os = "macos", - target_os = "solaris", target_os = "illumos", )))] compile_error!("unsupported target for `mio::unix::pipe`"); diff --git a/src/sys/unix/selector/epoll.rs b/src/sys/unix/selector/epoll.rs index 38667d66c..f4430909b 100644 --- a/src/sys/unix/selector/epoll.rs +++ b/src/sys/unix/selector/epoll.rs @@ -222,7 +222,7 @@ pub mod event { libc::EPOLLET, libc::EPOLLRDHUP, libc::EPOLLONESHOT, - #[cfg(any(target_os = "linux", target_os = "solaris"))] + #[cfg(target_os = "linux")] libc::EPOLLEXCLUSIVE, #[cfg(any(target_os = "android", target_os = "linux"))] libc::EPOLLWAKEUP, diff --git a/src/sys/unix/selector/mod.rs b/src/sys/unix/selector/mod.rs index b73d645bd..da61e14d7 100644 --- a/src/sys/unix/selector/mod.rs +++ b/src/sys/unix/selector/mod.rs @@ -1,17 +1,7 @@ -#[cfg(any( - target_os = "android", - target_os = "illumos", - target_os = "linux", - target_os = "solaris" -))] +#[cfg(any(target_os = "android", target_os = "illumos", target_os = "linux"))] mod epoll; -#[cfg(any( - target_os = "android", - target_os = "illumos", - target_os = "linux", - target_os = "solaris" -))] +#[cfg(any(target_os = "android", target_os = "illumos", target_os = "linux"))] pub(crate) use self::epoll::{event, Event, Events, Selector}; #[cfg(any( diff --git a/src/sys/unix/tcp.rs b/src/sys/unix/tcp.rs index f26bb303d..5b02cfcb5 100644 --- a/src/sys/unix/tcp.rs +++ b/src/sys/unix/tcp.rs @@ -88,7 +88,6 @@ pub(crate) fn accept(listener: &net::TcpListener) -> io::Result<(net::TcpStream, all(target_arch = "x86", target_os = "android"), target_os = "ios", target_os = "macos", - target_os = "solaris" ))] let stream = { syscall!(accept( diff --git a/src/sys/unix/uds/listener.rs b/src/sys/unix/uds/listener.rs index 84a9591b5..b6218427f 100644 --- a/src/sys/unix/uds/listener.rs +++ b/src/sys/unix/uds/listener.rs @@ -42,7 +42,6 @@ pub(crate) fn accept(listener: &net::UnixListener) -> io::Result<(UnixStream, So target_os = "ios", target_os = "macos", target_os = "netbsd", - target_os = "solaris", // Android x86's seccomp profile forbids calls to `accept4(2)` // See https://github.com/tokio-rs/mio/issues/1445 for details all( @@ -65,7 +64,6 @@ pub(crate) fn accept(listener: &net::UnixListener) -> io::Result<(UnixStream, So target_os = "ios", target_os = "macos", target_os = "netbsd", - target_os = "solaris", all(target_arch = "x86", target_os = "android") ))] let socket = syscall!(accept( diff --git a/src/sys/unix/uds/mod.rs b/src/sys/unix/uds/mod.rs index 3ec829f0c..8e28a9573 100644 --- a/src/sys/unix/uds/mod.rs +++ b/src/sys/unix/uds/mod.rs @@ -77,20 +77,20 @@ cfg_os_poll! { fn pair(flags: libc::c_int) -> io::Result<(T, T)> where T: FromRawFd, { - #[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "solaris")))] + #[cfg(not(any(target_os = "ios", target_os = "macos")))] let flags = flags | libc::SOCK_NONBLOCK | libc::SOCK_CLOEXEC; let mut fds = [-1; 2]; syscall!(socketpair(libc::AF_UNIX, flags, 0, fds.as_mut_ptr()))?; let pair = unsafe { (T::from_raw_fd(fds[0]), T::from_raw_fd(fds[1])) }; - // Darwin and Solaris do not have SOCK_NONBLOCK or SOCK_CLOEXEC. + // Darwin doesn't have SOCK_NONBLOCK or SOCK_CLOEXEC. // // In order to set those flags, additional `fcntl` sys calls must be // performed. If a `fnctl` fails after the sockets have been created, // the file descriptors will leak. Creating `pair` above ensures that if // there is an error, the file descriptors are closed. - #[cfg(any(target_os = "ios", target_os = "macos", target_os = "solaris"))] + #[cfg(any(target_os = "ios", target_os = "macos"))] { syscall!(fcntl(fds[0], libc::F_SETFL, libc::O_NONBLOCK))?; syscall!(fcntl(fds[0], libc::F_SETFD, libc::FD_CLOEXEC))?; diff --git a/src/sys/unix/waker.rs b/src/sys/unix/waker.rs index a7cf484e5..684fee981 100644 --- a/src/sys/unix/waker.rs +++ b/src/sys/unix/waker.rs @@ -103,7 +103,6 @@ pub use self::kqueue::Waker; target_os = "illumos", target_os = "netbsd", target_os = "openbsd", - target_os = "solaris" ))] mod pipe { use crate::sys::unix::Selector; @@ -175,6 +174,5 @@ mod pipe { target_os = "illumos", target_os = "netbsd", target_os = "openbsd", - target_os = "solaris" ))] pub use self::pipe::Waker; diff --git a/tests/tcp_stream.rs b/tests/tcp_stream.rs index ec55341bd..a0c7d3b79 100644 --- a/tests/tcp_stream.rs +++ b/tests/tcp_stream.rs @@ -542,12 +542,7 @@ fn tcp_shutdown_client_read_close_event() { #[test] #[cfg_attr(windows, ignore = "fails; client write_closed events are not found")] #[cfg_attr( - any( - target_os = "android", - target_os = "illumos", - target_os = "linux", - target_os = "solaris" - ), + any(target_os = "android", target_os = "illumos", target_os = "linux"), ignore = "fails; client write_closed events are not found" )] fn tcp_shutdown_client_write_close_event() {