diff --git a/src/backend/libc/net/syscalls.rs b/src/backend/libc/net/syscalls.rs index 091a64c36..23072c68e 100644 --- a/src/backend/libc/net/syscalls.rs +++ b/src/backend/libc/net/syscalls.rs @@ -853,6 +853,7 @@ pub(crate) mod sockopt { } #[inline] + #[cfg(not(apple))] // Apple platforms declare the constant, but do not actually implement it. pub(crate) fn get_socket_acceptconn(fd: BorrowedFd<'_>) -> io::Result { getsockopt(fd, c::SOL_SOCKET as _, c::SO_ACCEPTCONN).map(to_bool) } diff --git a/src/net/sockopt.rs b/src/net/sockopt.rs index 284ce7bcd..d88c274fc 100644 --- a/src/net/sockopt.rs +++ b/src/net/sockopt.rs @@ -824,7 +824,6 @@ pub fn get_socket_domain(fd: Fd) -> io::Result { /// - [Linux `socket`] /// - [Winsock2 `getsockopt`] /// - [Winsock2 `SOL_SOCKET` options] -/// - [Apple] /// - [FreeBSD] /// - [NetBSD] /// - [OpenBSD] @@ -839,7 +838,6 @@ pub fn get_socket_domain(fd: Fd) -> io::Result { /// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html /// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt /// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options -/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2 /// [NetBSD]: https://man.netbsd.org/getsockopt.2 /// [OpenBSD]: https://man.openbsd.org/getsockopt.2 @@ -847,6 +845,7 @@ pub fn get_socket_domain(fd: Fd) -> io::Result { /// [illumos]: https://illumos.org/man/3SOCKET/getsockopt /// [glibc `getsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html /// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html +#[cfg(not(apple))] // Apple platforms declare the constant, but do not actually implement it. #[inline] #[doc(alias = "SO_ACCEPTCONN")] pub fn get_socket_acceptconn(fd: Fd) -> io::Result { diff --git a/tests/net/sockopt.rs b/tests/net/sockopt.rs index be126e4e3..cf58af301 100644 --- a/tests/net/sockopt.rs +++ b/tests/net/sockopt.rs @@ -65,6 +65,8 @@ fn test_sockopts_ipv4() { rustix::net::sockopt::get_socket_domain(&s).unwrap(), AddressFamily::INET ); + + #[cfg(not(apple))] assert!(!rustix::net::sockopt::get_socket_acceptconn(&s).unwrap()); // Set a timeout.