Fix MSG_CMSG_CLOEXEC
for macos
This commit is contained in:
parent
c2a1b50140
commit
b01ce2cfd0
1 changed files with 18 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue