Skip to content

Commit

Permalink
Add Apple visionOS support
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinPerez authored Jul 2, 2024
1 parent 8c97337 commit 3a93893
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ jobs:
- aarch64-apple-darwin
- aarch64-apple-ios
- aarch64-apple-tvos
- aarch64-apple-visionos
- aarch64-apple-watchos
- aarch64-linux-android
- aarch64-unknown-freebsd
Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ impl TcpKeepalive {
target_os = "fuchsia",
target_os = "illumos",
target_os = "ios",
target_os = "visionos",
target_os = "linux",
target_os = "macos",
target_os = "netbsd",
Expand All @@ -531,6 +532,7 @@ impl TcpKeepalive {
target_os = "fuchsia",
target_os = "illumos",
target_os = "ios",
target_os = "visionos",
target_os = "linux",
target_os = "macos",
target_os = "netbsd",
Expand Down Expand Up @@ -559,6 +561,7 @@ impl TcpKeepalive {
target_os = "fuchsia",
target_os = "illumos",
target_os = "ios",
target_os = "visionos",
target_os = "linux",
target_os = "macos",
target_os = "netbsd",
Expand All @@ -577,6 +580,7 @@ impl TcpKeepalive {
target_os = "fuchsia",
target_os = "illumos",
target_os = "ios",
target_os = "visionos",
target_os = "linux",
target_os = "macos",
target_os = "netbsd",
Expand Down
3 changes: 3 additions & 0 deletions src/sockaddr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ impl From<SocketAddrV4> for SockAddr {
target_os = "haiku",
target_os = "hermit",
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "netbsd",
target_os = "nto",
Expand Down Expand Up @@ -334,6 +335,7 @@ impl From<SocketAddrV6> for SockAddr {
target_os = "haiku",
target_os = "hermit",
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "netbsd",
target_os = "nto",
Expand All @@ -358,6 +360,7 @@ impl fmt::Debug for SockAddr {
target_os = "haiku",
target_os = "hermit",
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "netbsd",
target_os = "nto",
Expand Down
5 changes: 5 additions & 0 deletions src/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,7 @@ fn set_common_flags(socket: Socket) -> io::Result<Socket> {
// On Apple platforms set `NOSIGPIPE`.
#[cfg(any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand Down Expand Up @@ -2048,6 +2049,7 @@ impl Socket {
target_os = "fuchsia",
target_os = "illumos",
target_os = "ios",
target_os = "visionos",
target_os = "linux",
target_os = "macos",
target_os = "netbsd",
Expand All @@ -2066,6 +2068,7 @@ impl Socket {
target_os = "fuchsia",
target_os = "illumos",
target_os = "ios",
target_os = "visionos",
target_os = "linux",
target_os = "macos",
target_os = "netbsd",
Expand Down Expand Up @@ -2095,6 +2098,7 @@ impl Socket {
target_os = "fuchsia",
target_os = "illumos",
target_os = "ios",
target_os = "visionos",
target_os = "linux",
target_os = "macos",
target_os = "netbsd",
Expand All @@ -2113,6 +2117,7 @@ impl Socket {
target_os = "fuchsia",
target_os = "illumos",
target_os = "ios",
target_os = "visionos",
target_os = "linux",
target_os = "macos",
target_os = "netbsd",
Expand Down
34 changes: 34 additions & 0 deletions src/sys/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use std::net::{Ipv4Addr, Ipv6Addr};
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -31,6 +32,7 @@ use std::num::NonZeroU32;
target_os = "android",
target_os = "freebsd",
target_os = "ios",
target_os = "visionos",
target_os = "linux",
target_os = "macos",
target_os = "tvos",
Expand All @@ -46,6 +48,7 @@ use std::os::unix::ffi::OsStrExt;
target_os = "android",
target_os = "freebsd",
target_os = "ios",
target_os = "visionos",
target_os = "linux",
target_os = "macos",
target_os = "tvos",
Expand All @@ -63,6 +66,7 @@ use std::{io, slice};

#[cfg(not(any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand Down Expand Up @@ -160,13 +164,15 @@ pub(crate) use libc::IP_RECVTOS;
pub(crate) use libc::IP_TOS;
#[cfg(not(any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
)))]
pub(crate) use libc::SO_LINGER;
#[cfg(any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand Down Expand Up @@ -202,6 +208,7 @@ pub(crate) use libc::{
target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "netbsd",
target_os = "nto",
Expand All @@ -217,6 +224,7 @@ pub(crate) use libc::{IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP};
target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
Expand All @@ -236,6 +244,7 @@ pub(crate) use libc::{
target_os = "fuchsia",
target_os = "illumos",
target_os = "ios",
target_os = "visionos",
target_os = "linux",
target_os = "macos",
target_os = "netbsd",
Expand All @@ -250,6 +259,7 @@ pub(crate) type Bool = c_int;

#[cfg(any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "nto",
target_os = "tvos",
Expand All @@ -259,6 +269,7 @@ use libc::TCP_KEEPALIVE as KEEPALIVE_TIME;
#[cfg(not(any(
target_os = "haiku",
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "nto",
target_os = "openbsd",
Expand All @@ -284,6 +295,7 @@ macro_rules! syscall {
/// Maximum size of a buffer passed to system call like `recv` and `send`.
#[cfg(not(any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -300,6 +312,7 @@ const MAX_BUF_LEN: usize = ssize_t::MAX as usize;
// both platforms.
#[cfg(any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand Down Expand Up @@ -339,6 +352,7 @@ type IovLen = usize;
target_os = "hurd",
target_os = "illumos",
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "netbsd",
target_os = "nto",
Expand Down Expand Up @@ -1234,6 +1248,7 @@ pub(crate) fn set_tcp_keepalive(fd: Socket, keepalive: &TcpKeepalive) -> io::Res
target_os = "hurd",
target_os = "illumos",
target_os = "ios",
target_os = "visionos",
target_os = "linux",
target_os = "macos",
target_os = "netbsd",
Expand Down Expand Up @@ -1462,6 +1477,7 @@ impl crate::Socket {
#[cfg_attr(
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos"
Expand Down Expand Up @@ -1498,6 +1514,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -1509,6 +1526,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -1521,6 +1539,7 @@ impl crate::Socket {

#[cfg(any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand Down Expand Up @@ -1957,6 +1976,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -1968,6 +1988,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -1993,6 +2014,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -2004,6 +2026,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -2029,6 +2052,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -2040,6 +2064,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -2060,6 +2085,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -2071,6 +2097,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -2088,6 +2115,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -2099,6 +2127,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -2119,6 +2148,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -2130,6 +2160,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand Down Expand Up @@ -2453,6 +2484,7 @@ impl crate::Socket {
target_os = "android",
target_os = "freebsd",
target_os = "ios",
target_os = "visionos",
target_os = "linux",
target_os = "macos",
target_os = "tvos",
Expand All @@ -2468,6 +2500,7 @@ impl crate::Socket {
target_os = "android",
target_os = "freebsd",
target_os = "ios",
target_os = "visionos",
target_os = "linux",
target_os = "macos",
target_os = "tvos",
Expand All @@ -2491,6 +2524,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand Down
Loading

1 comment on commit 3a93893

@yury
Copy link

@yury yury commented on 3a93893 Aug 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any plans to release with visionos support?

Please sign in to comment.