diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 72eb60c6..0ffaf31e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -80,6 +80,7 @@ jobs: - aarch64-unknown-redox - arm-linux-androideabi - arm64_32-apple-watchos + - armv6k-nintendo-3ds - armv7-linux-androideabi - armv7-sony-vita-newlibeabihf - armv7-unknown-linux-ohos diff --git a/src/lib.rs b/src/lib.rs index f05a294b..1f9100fd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -61,11 +61,11 @@ #![doc(test(attr(deny(warnings))))] use std::fmt; -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] use std::io::IoSlice; -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] use std::marker::PhantomData; -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] use std::mem; use std::mem::MaybeUninit; use std::net::SocketAddr; @@ -279,13 +279,21 @@ impl Type { pub const DCCP: Type = Type(sys::SOCK_DCCP); /// Type corresponding to `SOCK_SEQPACKET`. - #[cfg(all(feature = "all", not(any(target_os = "espidf", target_os = "wasi"))))] + #[cfg(all( + feature = "all", + not(any(target_os = "espidf", target_os = "wasi", target_os = "horizon")) + ))] pub const SEQPACKET: Type = Type(sys::SOCK_SEQPACKET); /// Type corresponding to `SOCK_RAW`. #[cfg(all( feature = "all", - not(any(target_os = "redox", target_os = "espidf", target_os = "wasi")) + not(any( + target_os = "redox", + target_os = "espidf", + target_os = "wasi", + target_os = "horizon" + )) ))] pub const RAW: Type = Type(sys::SOCK_RAW); } @@ -371,11 +379,11 @@ impl From for c_int { /// Flags for incoming messages. /// /// Flags provide additional information about incoming messages. -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] #[derive(Copy, Clone, Eq, PartialEq)] pub struct RecvFlags(c_int); -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] impl RecvFlags { /// Check if the message contains a truncated datagram. /// @@ -445,6 +453,7 @@ pub struct TcpKeepalive { target_os = "espidf", target_os = "vita", target_os = "haiku", + target_os = "horizon" )))] interval: Option, #[cfg(not(any( @@ -455,6 +464,7 @@ pub struct TcpKeepalive { target_os = "espidf", target_os = "vita", target_os = "haiku", + target_os = "horizon" )))] retries: Option, } @@ -473,6 +483,7 @@ impl TcpKeepalive { target_os = "espidf", target_os = "vita", target_os = "haiku", + target_os = "horizon" )))] interval: None, #[cfg(not(any( @@ -483,6 +494,7 @@ impl TcpKeepalive { target_os = "espidf", target_os = "vita", target_os = "haiku", + target_os = "horizon" )))] retries: None, } @@ -573,7 +585,7 @@ impl TcpKeepalive { /// /// This wraps `msghdr` on Unix and `WSAMSG` on Windows. Also see [`MsgHdrMut`] /// for the variant used by `recvmsg(2)`. -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] #[repr(transparent)] pub struct MsgHdr<'addr, 'bufs, 'control> { inner: sys::msghdr, @@ -581,7 +593,7 @@ pub struct MsgHdr<'addr, 'bufs, 'control> { _lifetimes: PhantomData<(&'addr SockAddr, &'bufs IoSlice<'bufs>, &'control [u8])>, } -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] impl<'addr, 'bufs, 'control> MsgHdr<'addr, 'bufs, 'control> { /// Create a new `MsgHdr` with all empty/zero fields. #[allow(clippy::new_without_default)] @@ -631,21 +643,21 @@ impl<'addr, 'bufs, 'control> MsgHdr<'addr, 'bufs, 'control> { } } -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] impl<'name, 'bufs, 'control> fmt::Debug for MsgHdr<'name, 'bufs, 'control> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { "MsgHdr".fmt(fmt) } } -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] unsafe impl Send for MsgHdr<'_, '_, '_> {} /// Configuration of a `recvmsg(2)` system call. /// /// This wraps `msghdr` on Unix and `WSAMSG` on Windows. Also see [`MsgHdr`] for /// the variant used by `sendmsg(2)`. -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] #[repr(transparent)] pub struct MsgHdrMut<'addr, 'bufs, 'control> { inner: sys::msghdr, @@ -657,7 +669,7 @@ pub struct MsgHdrMut<'addr, 'bufs, 'control> { )>, } -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] impl<'addr, 'bufs, 'control> MsgHdrMut<'addr, 'bufs, 'control> { /// Create a new `MsgHdrMut` with all empty/zero fields. #[allow(clippy::new_without_default)] @@ -712,12 +724,12 @@ impl<'addr, 'bufs, 'control> MsgHdrMut<'addr, 'bufs, 'control> { } } -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] impl<'name, 'bufs, 'control> fmt::Debug for MsgHdrMut<'name, 'bufs, 'control> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { "MsgHdrMut".fmt(fmt) } } -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] unsafe impl Send for MsgHdrMut<'_, '_, '_> {} diff --git a/src/socket.rs b/src/socket.rs index b258c93c..5f37529d 100644 --- a/src/socket.rs +++ b/src/socket.rs @@ -8,7 +8,7 @@ use std::fmt; use std::io::{self, Read, Write}; -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] use std::io::{IoSlice, IoSliceMut}; use std::mem::MaybeUninit; #[cfg(not(target_os = "nto"))] @@ -21,10 +21,10 @@ use std::os::windows::io::{FromRawSocket, IntoRawSocket}; use std::time::Duration; use crate::sys::{self, c_int, getsockopt, setsockopt, Bool}; -#[cfg(all(unix, not(target_os = "redox")))] +#[cfg(all(unix, not(any(target_os = "redox", target_os = "horizon"))))] use crate::MsgHdrMut; use crate::{Domain, Protocol, SockAddr, TcpKeepalive, Type}; -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] use crate::{MaybeUninitSlice, MsgHdr, RecvFlags}; /// Owned wrapper around a system socket. @@ -470,7 +470,7 @@ impl Socket { /// Note that the [`io::Read::read_vectored`] implementation calls this /// function with `buf`s of type `&mut [IoSliceMut]`, allowing initialised /// buffers to be used without using `unsafe`. - #[cfg(not(any(target_os = "redox", target_os = "wasi")))] + #[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] pub fn recv_vectored( &self, bufs: &mut [MaybeUninitSlice<'_>], @@ -489,7 +489,7 @@ impl Socket { /// as [`recv_vectored`]. /// /// [`recv_vectored`]: Socket::recv_vectored - #[cfg(not(any(target_os = "redox", target_os = "wasi")))] + #[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] pub fn recv_vectored_with_flags( &self, bufs: &mut [MaybeUninitSlice<'_>], @@ -554,7 +554,7 @@ impl Socket { /// as [`recv_vectored`]. /// /// [`recv_vectored`]: Socket::recv_vectored - #[cfg(not(any(target_os = "redox", target_os = "wasi")))] + #[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] pub fn recv_from_vectored( &self, bufs: &mut [MaybeUninitSlice<'_>], @@ -573,7 +573,7 @@ impl Socket { /// as [`recv_vectored`]. /// /// [`recv_vectored`]: Socket::recv_vectored - #[cfg(not(any(target_os = "redox", target_os = "wasi")))] + #[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] pub fn recv_from_vectored_with_flags( &self, bufs: &mut [MaybeUninitSlice<'_>], @@ -632,7 +632,7 @@ impl Socket { /// /// for an example (in C++). #[doc = man_links!(recvmsg(2))] - #[cfg(all(unix, not(target_os = "redox")))] + #[cfg(all(unix, not(any(target_os = "redox", target_os = "horizon"))))] pub fn recvmsg(&self, msg: &mut MsgHdrMut<'_, '_, '_>, flags: sys::c_int) -> io::Result { sys::recvmsg(self.as_raw(), msg, flags) } @@ -657,7 +657,7 @@ impl Socket { } /// Send data to the connected peer. Returns the amount of bytes written. - #[cfg(not(any(target_os = "redox", target_os = "wasi")))] + #[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] pub fn send_vectored(&self, bufs: &[IoSlice<'_>]) -> io::Result { self.send_vectored_with_flags(bufs, 0) } @@ -667,7 +667,7 @@ impl Socket { #[doc = man_links!(sendmsg(2))] /// /// [`send_vectored`]: Socket::send_vectored - #[cfg(not(any(target_os = "redox", target_os = "wasi")))] + #[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] pub fn send_vectored_with_flags( &self, bufs: &[IoSlice<'_>], @@ -714,7 +714,7 @@ impl Socket { /// Send data to a peer listening on `addr`. Returns the amount of bytes /// written. #[doc = man_links!(sendmsg(2))] - #[cfg(not(any(target_os = "redox", target_os = "wasi")))] + #[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] pub fn send_to_vectored(&self, bufs: &[IoSlice<'_>], addr: &SockAddr) -> io::Result { self.send_to_vectored_with_flags(bufs, addr, 0) } @@ -723,7 +723,7 @@ impl Socket { /// arbitrary flags to the underlying `sendmsg`/`WSASendTo` call. /// /// [`send_to_vectored`]: Socket::send_to_vectored - #[cfg(not(any(target_os = "redox", target_os = "wasi")))] + #[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] pub fn send_to_vectored_with_flags( &self, bufs: &[IoSlice<'_>], @@ -735,7 +735,7 @@ impl Socket { /// Send a message on a socket using a message structure. #[doc = man_links!(sendmsg(2))] - #[cfg(not(any(target_os = "redox", target_os = "wasi")))] + #[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] pub fn sendmsg(&self, msg: &MsgHdr<'_, '_, '_>, flags: sys::c_int) -> io::Result { sys::sendmsg(self.as_raw(), msg, flags) } @@ -1211,7 +1211,12 @@ impl Socket { /// [`set_header_included_v4`]: Socket::set_header_included_v4 #[cfg(all( feature = "all", - not(any(target_os = "redox", target_os = "espidf", target_os = "wasi")) + not(any( + target_os = "redox", + target_os = "espidf", + target_os = "wasi", + target_os = "horizon" + )) ))] pub fn header_included_v4(&self) -> io::Result { unsafe { @@ -1237,7 +1242,12 @@ impl Socket { )] #[cfg(all( feature = "all", - not(any(target_os = "redox", target_os = "espidf", target_os = "wasi")) + not(any( + target_os = "redox", + target_os = "espidf", + target_os = "wasi", + target_os = "horizon" + )) ))] pub fn set_header_included_v4(&self, included: bool) -> io::Result<()> { unsafe { @@ -1344,6 +1354,7 @@ impl Socket { target_os = "vita", target_os = "cygwin", target_os = "wasi", + target_os = "horizon" )))] pub fn join_multicast_v4_n( &self, @@ -1379,6 +1390,7 @@ impl Socket { target_os = "vita", target_os = "cygwin", target_os = "wasi", + target_os = "horizon" )))] pub fn leave_multicast_v4_n( &self, @@ -1415,6 +1427,7 @@ impl Socket { target_os = "espidf", target_os = "vita", target_os = "wasi", + target_os = "horizon" )))] pub fn join_ssm_v4( &self, @@ -1454,6 +1467,7 @@ impl Socket { target_os = "espidf", target_os = "vita", target_os = "wasi", + target_os = "horizon" )))] pub fn leave_ssm_v4( &self, @@ -1677,6 +1691,7 @@ impl Socket { target_os = "vita", target_os = "cygwin", target_os = "wasi", + target_os = "horizon" )))] pub fn set_recv_tos_v4(&self, recv_tos: bool) -> io::Result<()> { unsafe { @@ -1710,6 +1725,7 @@ impl Socket { target_os = "vita", target_os = "cygwin", target_os = "wasi", + target_os = "horizon" )))] pub fn recv_tos_v4(&self) -> io::Result { unsafe { @@ -1754,6 +1770,7 @@ impl Socket { target_os = "dragonfly", target_os = "netbsd", target_os = "wasi", + target_os = "horizon" )) ))] pub fn header_included_v6(&self) -> io::Result { @@ -1785,6 +1802,7 @@ impl Socket { target_os = "dragonfly", target_os = "netbsd", target_os = "wasi", + target_os = "horizon" )) ))] pub fn set_header_included_v6(&self, included: bool) -> io::Result<()> { @@ -2084,6 +2102,7 @@ impl Socket { target_os = "espidf", target_os = "vita", target_os = "wasi", + target_os = "horizon" )))] pub fn recv_tclass_v6(&self) -> io::Result { unsafe { @@ -2110,6 +2129,7 @@ impl Socket { target_os = "espidf", target_os = "vita", target_os = "wasi", + target_os = "horizon" )))] pub fn set_recv_tclass_v6(&self, recv_tclass: bool) -> io::Result<()> { unsafe { @@ -2144,6 +2164,7 @@ impl Socket { target_os = "vita", target_os = "cygwin", target_os = "wasi", + target_os = "horizon" )) ))] pub fn recv_hoplimit_v6(&self) -> io::Result { @@ -2174,6 +2195,7 @@ impl Socket { target_os = "vita", target_os = "cygwin", target_os = "wasi", + target_os = "horizon" )) ))] pub fn set_recv_hoplimit_v6(&self, recv_hoplimit: bool) -> io::Result<()> { @@ -2373,7 +2395,7 @@ impl Read for Socket { self.recv(buf) } - #[cfg(not(any(target_os = "redox", target_os = "wasi")))] + #[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> io::Result { // Safety: both `IoSliceMut` and `MaybeUninitSlice` promise to have the // same layout, that of `iovec`/`WSABUF`. Furthermore, `recv_vectored` @@ -2391,7 +2413,7 @@ impl<'a> Read for &'a Socket { self.recv(buf) } - #[cfg(not(any(target_os = "redox", target_os = "wasi")))] + #[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> io::Result { // Safety: see other `Read::read` impl. let bufs = unsafe { &mut *(bufs as *mut [IoSliceMut<'_>] as *mut [MaybeUninitSlice<'_>]) }; @@ -2404,7 +2426,7 @@ impl Write for Socket { self.send(buf) } - #[cfg(not(any(target_os = "redox", target_os = "wasi")))] + #[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> io::Result { self.send_vectored(bufs) } @@ -2419,7 +2441,7 @@ impl<'a> Write for &'a Socket { self.send(buf) } - #[cfg(not(any(target_os = "redox", target_os = "wasi")))] + #[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> io::Result { self.send_vectored(bufs) } diff --git a/src/sys/unix.rs b/src/sys/unix.rs index 0c2f7eb7..dbd619be 100644 --- a/src/sys/unix.rs +++ b/src/sys/unix.rs @@ -9,7 +9,7 @@ use std::cmp::min; #[cfg(not(target_os = "wasi"))] use std::ffi::OsStr; -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] use std::io::IoSlice; use std::marker::PhantomData; use std::mem::{self, size_of, MaybeUninit}; @@ -70,7 +70,7 @@ use libc::{in6_addr, in_addr}; #[cfg(not(target_os = "wasi"))] use crate::SockAddrStorage; use crate::{Domain, Protocol, SockAddr, TcpKeepalive, Type}; -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] use crate::{MsgHdr, MsgHdrMut, RecvFlags}; pub(crate) use std::ffi::c_int; @@ -84,10 +84,18 @@ pub(crate) use libc::{AF_INET, AF_INET6}; pub(crate) use libc::SOCK_DCCP; #[cfg(all( feature = "all", - not(any(target_os = "redox", target_os = "espidf", target_os = "wasi")) + not(any( + target_os = "redox", + target_os = "espidf", + target_os = "wasi", + target_os = "horizon" + )) ))] pub(crate) use libc::SOCK_RAW; -#[cfg(all(feature = "all", not(any(target_os = "espidf", target_os = "wasi"))))] +#[cfg(all( + feature = "all", + not(any(target_os = "espidf", target_os = "wasi", target_os = "horizon")) +))] pub(crate) use libc::SOCK_SEQPACKET; pub(crate) use libc::{SOCK_DGRAM, SOCK_STREAM}; // Used in `Protocol`. @@ -117,7 +125,12 @@ pub(crate) use libc::{ sa_family_t, sockaddr, sockaddr_in, sockaddr_in6, sockaddr_storage, socklen_t, }; // Used in `RecvFlags`. -#[cfg(not(any(target_os = "redox", target_os = "espidf", target_os = "wasi")))] +#[cfg(not(any( + target_os = "redox", + target_os = "espidf", + target_os = "wasi", + target_os = "horizon" +)))] pub(crate) use libc::MSG_TRUNC; #[cfg(not(any(target_os = "redox", target_os = "wasi")))] pub(crate) use libc::SO_OOBINLINE; @@ -142,6 +155,7 @@ pub(crate) use libc::IPV6_HDRINCL; target_os = "vita", target_os = "wasi", target_os = "cygwin", + target_os = "horizon" )) ))] pub(crate) use libc::IPV6_RECVHOPLIMIT; @@ -158,11 +172,17 @@ pub(crate) use libc::IPV6_RECVHOPLIMIT; target_os = "espidf", target_os = "vita", target_os = "wasi", + target_os = "horizon" )))] pub(crate) use libc::IPV6_RECVTCLASS; #[cfg(all( feature = "all", - not(any(target_os = "redox", target_os = "espidf", target_os = "wasi")) + not(any( + target_os = "redox", + target_os = "espidf", + target_os = "wasi", + target_os = "horizon" + )) ))] pub(crate) use libc::IP_HDRINCL; #[cfg(not(any( @@ -181,6 +201,7 @@ pub(crate) use libc::IP_HDRINCL; target_os = "vita", target_os = "wasi", target_os = "cygwin", + target_os = "horizon" )))] pub(crate) use libc::IP_RECVTOS; #[cfg(not(any( @@ -233,6 +254,7 @@ pub(crate) use libc::{ target_os = "espidf", target_os = "vita", target_os = "wasi", + target_os = "horizon" )))] pub(crate) use libc::{ ip_mreq_source as IpMreqSource, IP_ADD_SOURCE_MEMBERSHIP, IP_DROP_SOURCE_MEMBERSHIP, @@ -505,16 +527,22 @@ impl_debug!( libc::SOCK_DGRAM, #[cfg(all(feature = "all", target_os = "linux"))] libc::SOCK_DCCP, - #[cfg(not(any(target_os = "redox", target_os = "espidf", target_os = "wasi")))] + #[cfg(not(any( + target_os = "redox", + target_os = "espidf", + target_os = "wasi", + target_os = "horizon" + )))] libc::SOCK_RAW, #[cfg(not(any( target_os = "redox", target_os = "haiku", target_os = "espidf", - target_os = "wasi" + target_os = "wasi", + target_os = "horizon" )))] libc::SOCK_RDM, - #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] + #[cfg(not(any(target_os = "espidf", target_os = "wasi", target_os = "horizon")))] libc::SOCK_SEQPACKET, /* TODO: add these optional bit OR-ed flags: #[cfg(any( @@ -569,7 +597,7 @@ impl_debug!( ); /// Unix-only API. -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] impl RecvFlags { /// Check if the message terminates a record. /// @@ -580,7 +608,7 @@ impl RecvFlags { /// On Unix this corresponds to the `MSG_EOR` flag. /// /// [`SEQPACKET`]: Type::SEQPACKET - #[cfg(not(target_os = "espidf"))] + #[cfg(not(any(target_os = "espidf", target_os = "horizon")))] pub const fn is_end_of_record(self) -> bool { self.0 & libc::MSG_EOR != 0 } @@ -622,11 +650,11 @@ impl RecvFlags { } } -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] impl std::fmt::Debug for RecvFlags { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let mut s = f.debug_struct("RecvFlags"); - #[cfg(not(target_os = "espidf"))] + #[cfg(not(any(target_os = "espidf", target_os = "horizon")))] s.field("is_end_of_record", &self.is_end_of_record()); s.field("is_out_of_band", &self.is_out_of_band()); #[cfg(not(target_os = "espidf"))] @@ -727,39 +755,39 @@ pub(crate) fn unix_sockaddr(path: &Path) -> io::Result { } // Used in `MsgHdr`. -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] pub(crate) use libc::msghdr; -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] pub(crate) fn set_msghdr_name(msg: &mut msghdr, name: &SockAddr) { msg.msg_name = name.as_ptr() as *mut _; msg.msg_namelen = name.len(); } -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] #[allow(clippy::unnecessary_cast)] // IovLen type can be `usize`. pub(crate) fn set_msghdr_iov(msg: &mut msghdr, ptr: *mut libc::iovec, len: usize) { msg.msg_iov = ptr; msg.msg_iovlen = min(len, IovLen::MAX as usize) as IovLen; } -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] pub(crate) fn set_msghdr_control(msg: &mut msghdr, ptr: *mut libc::c_void, len: usize) { msg.msg_control = ptr; msg.msg_controllen = len as _; } -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] pub(crate) fn set_msghdr_flags(msg: &mut msghdr, flags: c_int) { msg.msg_flags = flags; } -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] pub(crate) fn msghdr_flags(msg: &msghdr) -> RecvFlags { RecvFlags(msg.msg_flags) } -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] pub(crate) fn msghdr_control_len(msg: &msghdr) -> usize { msg.msg_controllen as _ } @@ -1086,7 +1114,7 @@ pub(crate) fn peek_sender(fd: RawSocket) -> io::Result { Ok(sender) } -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] pub(crate) fn recv_vectored( fd: RawSocket, bufs: &mut [crate::MaybeUninitSlice<'_>], @@ -1097,7 +1125,7 @@ pub(crate) fn recv_vectored( Ok((n, msg.flags())) } -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] pub(crate) fn recv_from_vectored( fd: RawSocket, bufs: &mut [crate::MaybeUninitSlice<'_>], @@ -1119,7 +1147,7 @@ pub(crate) fn recv_from_vectored( Ok((n, msg.flags(), addr)) } -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] pub(crate) fn recvmsg( fd: RawSocket, msg: &mut MsgHdrMut<'_, '_, '_>, @@ -1138,7 +1166,7 @@ pub(crate) fn send(fd: RawSocket, buf: &[u8], flags: c_int) -> io::Result .map(|n| n as usize) } -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] pub(crate) fn send_vectored( fd: RawSocket, bufs: &[IoSlice<'_>], @@ -1165,7 +1193,7 @@ pub(crate) fn send_to( .map(|n| n as usize) } -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] pub(crate) fn send_to_vectored( fd: RawSocket, bufs: &[IoSlice<'_>], @@ -1176,7 +1204,7 @@ pub(crate) fn send_to_vectored( sendmsg(fd, &msg, flags) } -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "horizon")))] pub(crate) fn sendmsg(fd: RawSocket, msg: &MsgHdr<'_, '_, '_>, flags: c_int) -> io::Result { syscall!(sendmsg(fd, &msg.inner, flags)).map(|n| n as usize) } @@ -1398,6 +1426,7 @@ pub(crate) fn from_in6_addr(addr: in6_addr) -> Ipv6Addr { target_os = "vita", target_os = "cygwin", target_os = "wasi", + target_os = "horizon" )))] pub(crate) const fn to_mreqn( multiaddr: &Ipv4Addr, @@ -1520,6 +1549,7 @@ impl crate::Socket { target_os = "tvos", target_os = "watchos", target_os = "wasi", + target_os = "horizon" ), allow(rustdoc::broken_intra_doc_links) )]