From e9e464a75338ee7ae53f53587b0cbdeda0947b47 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Sat, 14 Sep 2024 10:37:07 +0200 Subject: [PATCH] Add support for visionOS (#202) --- examples/kqueue-process.rs | 10 ++-------- src/lib.rs | 25 +++++-------------------- src/os.rs | 5 +---- src/os/unix.rs | 5 +---- src/reactor.rs | 5 +---- 5 files changed, 10 insertions(+), 40 deletions(-) diff --git a/examples/kqueue-process.rs b/examples/kqueue-process.rs index c88ccc4..9cdae1c 100644 --- a/examples/kqueue-process.rs +++ b/examples/kqueue-process.rs @@ -7,10 +7,7 @@ //! ``` #[cfg(any( - target_os = "macos", - target_os = "ios", - target_os = "tvos", - target_os = "watchos", + target_vendor = "apple", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd", @@ -40,10 +37,7 @@ fn main() -> std::io::Result<()> { } #[cfg(not(any( - target_os = "macos", - target_os = "ios", - target_os = "tvos", - target_os = "watchos", + target_vendor = "apple", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd", diff --git a/src/lib.rs b/src/lib.rs index 15f388d..0636fce 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1256,7 +1256,7 @@ unsafe impl IoSafe for std::io::BufWriter {} unsafe impl IoSafe for std::io::LineWriter {} unsafe impl IoSafe for &mut T {} unsafe impl IoSafe for Box {} -unsafe impl IoSafe for std::borrow::Cow<'_, T> {} +unsafe impl IoSafe for std::borrow::Cow<'_, T> {} impl AsyncRead for Async { fn poll_read( @@ -2101,20 +2101,14 @@ fn connect( let socket = { #[cfg(not(any( target_os = "aix", - target_os = "macos", - target_os = "ios", - target_os = "tvos", - target_os = "watchos", + target_vendor = "apple", target_os = "espidf", windows, )))] let flags = rn::SocketFlags::CLOEXEC; #[cfg(any( target_os = "aix", - target_os = "macos", - target_os = "ios", - target_os = "tvos", - target_os = "watchos", + target_vendor = "apple", target_os = "espidf", windows, ))] @@ -2124,13 +2118,7 @@ fn connect( let socket = rn::socket_with(domain, rn::SocketType::STREAM, flags, protocol)?; // Set cloexec if necessary. - #[cfg(any( - target_os = "aix", - target_os = "macos", - target_os = "ios", - target_os = "tvos", - target_os = "watchos", - ))] + #[cfg(any(target_os = "aix", target_vendor = "apple"))] rio::fcntl_setfd(&socket, rio::fcntl_getfd(&socket)? | rio::FdFlags::CLOEXEC)?; // Set non-blocking mode. @@ -2141,10 +2129,7 @@ fn connect( // Set nosigpipe if necessary. #[cfg(any( - target_os = "macos", - target_os = "ios", - target_os = "tvos", - target_os = "watchos", + target_vendor = "apple", target_os = "freebsd", target_os = "netbsd", target_os = "dragonfly", diff --git a/src/os.rs b/src/os.rs index bb5e660..abc03bb 100644 --- a/src/os.rs +++ b/src/os.rs @@ -4,10 +4,7 @@ pub mod unix; #[cfg(any( - target_os = "macos", - target_os = "ios", - target_os = "tvos", - target_os = "watchos", + target_vendor = "apple", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd", diff --git a/src/os/unix.rs b/src/os/unix.rs index fe9fba2..87fbf2c 100644 --- a/src/os/unix.rs +++ b/src/os/unix.rs @@ -48,10 +48,7 @@ pub fn reactor_fd() -> Option> { target_os = "android", target_os = "illumos", target_os = "solaris", - target_os = "macos", - target_os = "ios", - target_os = "tvos", - target_os = "watchos", + target_vendor = "apple", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd", diff --git a/src/reactor.rs b/src/reactor.rs index d6f4ad9..474c62a 100644 --- a/src/reactor.rs +++ b/src/reactor.rs @@ -24,10 +24,7 @@ cfg_if::cfg_if! { mod windows; pub use windows::Registration; } else if #[cfg(any( - target_os = "macos", - target_os = "ios", - target_os = "tvos", - target_os = "watchos", + target_vendor = "apple", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd",