Skip to content

Commit

Permalink
Add Apple visionOS support
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinPerez committed Apr 8, 2024
1 parent c93cdcc commit 2d4e79a
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,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 @@ -530,6 +531,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 @@ -558,6 +560,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 @@ -576,6 +579,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 @@ -1947,6 +1948,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 @@ -1965,6 +1967,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 @@ -1994,6 +1997,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 @@ -2012,6 +2016,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 @@ -200,6 +206,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 @@ -215,6 +222,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 @@ -234,6 +242,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 @@ -248,6 +257,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 @@ -257,6 +267,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 @@ -282,6 +293,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 @@ -298,6 +310,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 @@ -337,6 +350,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 @@ -1227,6 +1241,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 @@ -1455,6 +1470,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 @@ -1491,6 +1507,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -1502,6 +1519,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -1514,6 +1532,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 @@ -1950,6 +1969,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -1961,6 +1981,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -1986,6 +2007,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -1997,6 +2019,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -2022,6 +2045,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -2033,6 +2057,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -2053,6 +2078,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -2064,6 +2090,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -2081,6 +2108,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -2092,6 +2120,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -2112,6 +2141,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand All @@ -2123,6 +2153,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 @@ -2446,6 +2477,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 @@ -2461,6 +2493,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 @@ -2484,6 +2517,7 @@ impl crate::Socket {
feature = "all",
any(
target_os = "ios",
target_os = "visionos",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
Expand Down

0 comments on commit 2d4e79a

Please sign in to comment.