about summary refs log tree commit diff
path: root/library/std/src/sys/unix
diff options
context:
space:
mode:
authorLinkTed <LinkTed@users.noreply.github.com>2020-09-22 13:17:12 +0200
committerLinkTed <LinkTed@users.noreply.github.com>2020-10-10 15:19:13 +0200
commitb01ce2cfd0e0182384cffe7db0c0b94c3414c610 (patch)
treecf5414393c19e57c0a227abf0462733c6223abb3 /library/std/src/sys/unix
parentc2a1b50140642f50b86ee7191b02737ba60848a7 (diff)
downloadrust-b01ce2cfd0e0182384cffe7db0c0b94c3414c610.tar.gz
rust-b01ce2cfd0e0182384cffe7db0c0b94c3414c610.zip
Fix `MSG_CMSG_CLOEXEC` for macos
Diffstat (limited to 'library/std/src/sys/unix')
-rw-r--r--library/std/src/sys/unix/net.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/library/std/src/sys/unix/net.rs b/library/std/src/sys/unix/net.rs
index 2bd6b84d671..8f28c75641f 100644
--- a/library/std/src/sys/unix/net.rs
+++ b/library/std/src/sys/unix/net.rs
@@ -237,6 +237,15 @@ impl Socket {
         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",
+    ))]
     pub fn recv_msg(&self, msg: &mut libc::msghdr) -> io::Result<usize> {
         let n = cvt(unsafe { libc::recvmsg(self.0.raw(), msg, libc::MSG_CMSG_CLOEXEC) })?;
         Ok(n as usize)
@@ -259,6 +268,15 @@ impl Socket {
         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",
+    ))]
     pub fn send_msg(&self, msg: &mut libc::msghdr) -> io::Result<usize> {
         let n = cvt(unsafe { libc::sendmsg(self.0.raw(), msg, 0) })?;
         Ok(n as usize)