mirror of
https://github.com/openharmony/third_party_rust_mio.git
synced 2026-07-01 20:53:59 -04:00
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.
This commit is contained in:
+1
-1
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
+3
-4
@@ -196,13 +196,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
|
||||
@@ -406,7 +405,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.
|
||||
|
||||
+3
-4
@@ -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,
|
||||
};
|
||||
|
||||
|
||||
@@ -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`");
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -77,20 +77,20 @@ cfg_os_poll! {
|
||||
fn pair<T>(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))?;
|
||||
|
||||
@@ -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;
|
||||
|
||||
+1
-6
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user