Skip to content

Commit

Permalink
Add support for visionOS (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm authored Sep 14, 2024
1 parent e8e7849 commit e9e464a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 40 deletions.
10 changes: 2 additions & 8 deletions examples/kqueue-process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
25 changes: 5 additions & 20 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,7 @@ unsafe impl<T: IoSafe + Write> IoSafe for std::io::BufWriter<T> {}
unsafe impl<T: IoSafe + Write> IoSafe for std::io::LineWriter<T> {}
unsafe impl<T: IoSafe + ?Sized> IoSafe for &mut T {}
unsafe impl<T: IoSafe + ?Sized> IoSafe for Box<T> {}
unsafe impl<T: Clone + IoSafe + ?Sized> IoSafe for std::borrow::Cow<'_, T> {}
unsafe impl<T: Clone + IoSafe> IoSafe for std::borrow::Cow<'_, T> {}

impl<T: IoSafe + Read> AsyncRead for Async<T> {
fn poll_read(
Expand Down Expand Up @@ -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,
))]
Expand All @@ -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.
Expand All @@ -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",
Expand Down
5 changes: 1 addition & 4 deletions src/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 1 addition & 4 deletions src/os/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@ pub fn reactor_fd() -> Option<BorrowedFd<'static>> {
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",
Expand Down
5 changes: 1 addition & 4 deletions src/reactor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit e9e464a

Please sign in to comment.