+// FIXME: This is currently disabled on *BSD.
+
use super::{sockaddr_un, SocketAddr};
use crate::io::{self, IoSlice, IoSliceMut};
use crate::marker::PhantomData;
-#[cfg(any(
- doc,
- target_os = "android",
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "linux",
- target_os = "netbsd",
- target_os = "openbsd",
-))]
+#[cfg(any(doc, target_os = "android", target_os = "linux"))]
use super::{recv_vectored_with_ancillary_from, send_vectored_with_ancillary_to, SocketAncillary};
use super::{sockaddr_un, SocketAddr};
-#[cfg(any(
- target_os = "android",
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "linux",
- target_os = "netbsd",
- target_os = "openbsd",
-))]
+#[cfg(any(doc, target_os = "android", target_os = "linux"))]
use crate::io::{IoSlice, IoSliceMut};
use crate::net::Shutdown;
use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
///
/// # Examples
///
- /// ```no_run
+ #[cfg_attr(any(target_os = "android", target_os = "linux"), doc = "```no_run")]
+ #[cfg_attr(not(any(target_os = "android", target_os = "linux")), doc = "```ignore")]
/// #![feature(unix_socket_ancillary_data)]
/// use std::os::unix::net::{UnixDatagram, SocketAncillary, AncillaryData};
/// use std::io::IoSliceMut;
/// Ok(())
/// }
/// ```
- #[cfg(any(
- target_os = "android",
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "linux",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(any(doc, target_os = "android", target_os = "linux"))]
#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
pub fn recv_vectored_with_ancillary_from(
&self,
///
/// # Examples
///
- /// ```no_run
+ #[cfg_attr(any(target_os = "android", target_os = "linux"), doc = "```no_run")]
+ #[cfg_attr(not(any(target_os = "android", target_os = "linux")), doc = "```ignore")]
/// #![feature(unix_socket_ancillary_data)]
/// use std::os::unix::net::{UnixDatagram, SocketAncillary, AncillaryData};
/// use std::io::IoSliceMut;
/// Ok(())
/// }
/// ```
- #[cfg(any(
- target_os = "android",
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "linux",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(any(doc, target_os = "android", target_os = "linux"))]
#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
pub fn recv_vectored_with_ancillary(
&self,
///
/// # Examples
///
- /// ```no_run
+ #[cfg_attr(any(target_os = "android", target_os = "linux"), doc = "```no_run")]
+ #[cfg_attr(not(any(target_os = "android", target_os = "linux")), doc = "```ignore")]
/// #![feature(unix_socket_ancillary_data)]
/// use std::os::unix::net::{UnixDatagram, SocketAncillary};
/// use std::io::IoSlice;
/// Ok(())
/// }
/// ```
- #[cfg(any(
- target_os = "android",
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "linux",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(any(doc, target_os = "android", target_os = "linux"))]
#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
pub fn send_vectored_with_ancillary_to<P: AsRef<Path>>(
&self,
///
/// # Examples
///
- /// ```no_run
+ #[cfg_attr(any(target_os = "android", target_os = "linux"), doc = "```no_run")]
+ #[cfg_attr(not(any(target_os = "android", target_os = "linux")), doc = "```ignore")]
/// #![feature(unix_socket_ancillary_data)]
/// use std::os::unix::net::{UnixDatagram, SocketAncillary};
/// use std::io::IoSlice;
/// Ok(())
/// }
/// ```
- #[cfg(any(
- target_os = "android",
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "linux",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(any(doc, target_os = "android", target_os = "linux"))]
#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
pub fn send_vectored_with_ancillary(
&self,
//! Unix-specific networking functionality.
+#![allow(irrefutable_let_patterns)]
#![stable(feature = "unix_socket", since = "1.10.0")]
mod addr;
-#[doc(cfg(any(
- target_os = "android",
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "linux",
- target_os = "netbsd",
- target_os = "openbsd",
-)))]
-#[cfg(any(
- doc,
- target_os = "android",
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "linux",
- target_os = "netbsd",
- target_os = "openbsd",
-))]
+#[doc(cfg(any(target_os = "android", target_os = "linux")))]
+#[cfg(any(doc, target_os = "android", target_os = "linux"))]
mod ancillary;
mod datagram;
mod listener;
#[stable(feature = "unix_socket", since = "1.10.0")]
pub use self::addr::*;
-#[cfg(any(
- doc,
- target_os = "android",
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "linux",
- target_os = "netbsd",
- target_os = "openbsd",
-))]
+#[cfg(any(doc, target_os = "android", target_os = "linux"))]
#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
pub use self::ancillary::*;
#[stable(feature = "unix_socket", since = "1.10.0")]
-#[cfg(any(
- doc,
- target_os = "android",
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "linux",
- target_os = "netbsd",
- target_os = "openbsd",
-))]
+#[cfg(any(doc, target_os = "android", target_os = "linux"))]
use super::{recv_vectored_with_ancillary_from, send_vectored_with_ancillary_to, SocketAncillary};
use super::{sockaddr_un, SocketAddr};
use crate::fmt;
///
/// # Examples
///
- /// ```no_run
+ #[cfg_attr(any(target_os = "android", target_os = "linux"), doc = "```no_run")]
+ #[cfg_attr(not(any(target_os = "android", target_os = "linux")), doc = "```ignore")]
/// #![feature(unix_socket_ancillary_data)]
/// use std::os::unix::net::{UnixStream, SocketAncillary, AncillaryData};
/// use std::io::IoSliceMut;
/// Ok(())
/// }
/// ```
- #[cfg(any(
- target_os = "android",
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "linux",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(any(doc, target_os = "android", target_os = "linux"))]
#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
pub fn recv_vectored_with_ancillary(
&self,
///
/// # Examples
///
- /// ```no_run
+ #[cfg_attr(any(target_os = "android", target_os = "linux"), doc = "```no_run")]
+ #[cfg_attr(not(any(target_os = "android", target_os = "linux")), doc = "```ignore")]
/// #![feature(unix_socket_ancillary_data)]
/// use std::os::unix::net::{UnixStream, SocketAncillary};
/// use std::io::IoSlice;
/// Ok(())
/// }
/// ```
- #[cfg(any(
- target_os = "android",
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "linux",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(any(doc, target_os = "android", target_os = "linux"))]
#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
pub fn send_vectored_with_ancillary(
&self,
use super::*;
use crate::io::prelude::*;
use crate::io::{self, ErrorKind, IoSlice, IoSliceMut};
-#[cfg(any(
- target_os = "android",
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "linux",
- target_os = "netbsd",
- target_os = "openbsd",
-))]
-#[cfg(any(
- target_os = "android",
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "linux",
- target_os = "netbsd",
- target_os = "openbsd",
-))]
+#[cfg(any(target_os = "android", target_os = "linux"))]
use crate::os::unix::io::AsRawFd;
use crate::sys_common::io::test::tmpdir;
use crate::thread;
assert_eq!(msg, &buf[..]);
}
-#[cfg(any(
- target_os = "android",
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "linux",
- target_os = "netbsd",
- target_os = "openbsd",
-))]
+#[cfg(any(target_os = "android", target_os = "linux"))]
#[test]
fn test_send_vectored_fds_unix_stream() {
let (s1, s2) = or_panic!(UnixStream::pair());
}
}
-#[cfg(any(target_os = "android", target_os = "emscripten", target_os = "linux",))]
+#[cfg(any(target_os = "android", target_os = "linux",))]
#[test]
fn test_send_vectored_with_ancillary_to_unix_datagram() {
fn getpid() -> libc::pid_t {
}
}
-#[cfg(any(
- target_os = "android",
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "linux",
- target_os = "netbsd",
- target_os = "openbsd",
-))]
+#[cfg(any(target_os = "android", target_os = "linux"))]
#[test]
fn test_send_vectored_with_ancillary_unix_datagram() {
let dir = tmpdir();
self.recv_from_with_flags(buf, 0)
}
- #[cfg(any(
- target_os = "android",
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "linux",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(any(target_os = "android", target_os = "linux"))]
pub fn recv_msg(&self, msg: &mut libc::msghdr) -> io::Result<usize> {
let n = cvt(unsafe { libc::recvmsg(self.as_raw_fd(), msg, libc::MSG_CMSG_CLOEXEC) })?;
Ok(n as usize)
self.0.is_write_vectored()
}
- #[cfg(any(
- target_os = "android",
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "linux",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(any(target_os = "android", target_os = "linux"))]
pub fn send_msg(&self, msg: &mut libc::msghdr) -> io::Result<usize> {
let n = cvt(unsafe { libc::sendmsg(self.as_raw_fd(), msg, 0) })?;
Ok(n as usize)