diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs index f25670956d..c81a8b6581 100644 --- a/src/sys/socket/mod.rs +++ b/src/sys/socket/mod.rs @@ -11,10 +11,14 @@ use sys::time::TimeVal; use sys::uio::IoVec; #[cfg(any( target_os = "linux", +target_os = "freebsd", +target_os = "netbsd", ))] use sys::time::TimeSpec; #[cfg(any( target_os = "linux", +target_os = "freebsd", +target_os = "netbsd", ))] use std::marker::PhantomData; @@ -1345,6 +1349,8 @@ pub fn shutdown(df: RawFd, how: Shutdown) -> Result<()> { #[cfg(any( target_os = "linux", + target_os = "freebsd", + target_os = "netbsd", ))] #[repr(C)] #[allow(missing_debug_implementations)] @@ -1352,6 +1358,8 @@ pub struct SendMMsgHdr<'a>(libc::mmsghdr, PhantomData<&'a ()>); #[cfg(any( target_os = "linux", + target_os = "freebsd", + target_os = "netbsd", ))] impl<'a> SendMMsgHdr<'a> { pub fn new(iov: &mut[IoVec<&'a mut [u8]>], @@ -1436,6 +1444,8 @@ impl<'a> SendMMsgHdr<'a> { #[cfg(any( target_os = "linux", + target_os = "freebsd", + target_os = "netbsd", ))] #[repr(C)] #[allow(missing_debug_implementations)] @@ -1443,6 +1453,8 @@ pub struct RecvMMsgHdr<'a>(libc::mmsghdr, PhantomData<&'a ()>); #[cfg(any( target_os = "linux", + target_os = "freebsd", + target_os = "netbsd", ))] impl<'a> RecvMMsgHdr<'a> { pub fn new(iov: &mut[IoVec<&'a mut [u8]>], @@ -1505,6 +1517,8 @@ impl<'a> RecvMMsgHdr<'a> { /// Receive multiple messages from a socket using a single system call. #[cfg(any( target_os = "linux", + target_os = "freebsd", + target_os = "netbsd", ))] pub fn recvmmsg(fd: RawFd, msgvec: &mut[RecvMMsgHdr], flags: MsgFlags, @@ -1528,6 +1542,8 @@ pub fn recvmmsg(fd: RawFd, msgvec: &mut[RecvMMsgHdr], /// Transmit multiple messages on a socket using a single system call. #[cfg(any( target_os = "linux", + target_os = "freebsd", + target_os = "netbsd", ))] pub fn sendmmsg(fd: RawFd, msgvec: &mut[SendMMsgHdr]) -> Result { let ret = unsafe { diff --git a/test/sys/test_socket.rs b/test/sys/test_socket.rs index c785a6031d..072a1b55f7 100644 --- a/test/sys/test_socket.rs +++ b/test/sys/test_socket.rs @@ -962,6 +962,8 @@ pub fn test_recv_ipv6pktinfo() { #[cfg(any( target_os = "linux", + target_os = "freebsd", + target_os = "netbsd", ))] #[test] pub fn test_mmsg() {