Skip to content

Commit 7476ff0

Browse files
authored
in recvmsg, pass in MSG_CMSG_CLOEXEC on illumos (#373)
Support for MSG_CMSG_CLOEXEC was added to illumos in a [recent commit]. To match the behavior on Linux, pass in the flag on illumos (the definition was added in libc 0.2.162). I've verified that the ipc-channel test suite still passes on an older illumos kernel which doesn't have support for it. This is okay because for returned fds, cloexec support is effectively best-effort. [recent commit]: illumos/illumos-gate@0250c53
1 parent aa43418 commit 7476ff0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fnv = "1.0.3"
3737
futures = { version = "0.3", optional = true }
3838
futures-test = { version = "0.3", optional = true }
3939
lazy_static = "1"
40-
libc = "0.2.161"
40+
libc = "0.2.162"
4141
rand = "0.8"
4242
serde = { version = "1.0", features = ["rc"] }
4343
uuid = { version = "1", features = ["v4"] }

src/platform/unix/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use std::hash::BuildHasherDefault;
3232
use std::io;
3333
use std::marker::PhantomData;
3434
use std::mem;
35-
use std::ops::{Deref, DerefMut, RangeFrom};
35+
use std::ops::{Deref, RangeFrom};
3636
use std::os::fd::RawFd;
3737
use std::ptr;
3838
use std::slice;
@@ -54,9 +54,9 @@ const SOCK_FLAGS: c_int = libc::SOCK_CLOEXEC;
5454
#[cfg(not(any(target_os = "linux", target_os = "illumos")))]
5555
const SOCK_FLAGS: c_int = 0;
5656

57-
#[cfg(target_os = "linux")]
57+
#[cfg(any(target_os = "linux", target_os = "illumos"))]
5858
const RECVMSG_FLAGS: c_int = libc::MSG_CMSG_CLOEXEC;
59-
#[cfg(not(target_os = "linux"))]
59+
#[cfg(not(any(target_os = "linux", target_os = "illumos")))]
6060
const RECVMSG_FLAGS: c_int = 0;
6161

6262
#[cfg(target_env = "gnu")]

0 commit comments

Comments
 (0)