Skip to content

Commit

Permalink
Add support for visionOS
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Sep 14, 2024
1 parent e8e7849 commit 3e8f4d1
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 39 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
23 changes: 4 additions & 19 deletions src/lib.rs
Original file line number Diff line number Diff line change
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 3e8f4d1

Please sign in to comment.