Skip to main content

socket_pair_cloexec

Function socket_pair_cloexec 

Source
pub fn socket_pair_cloexec() -> Result<SocketPair>
Expand description

Create an owned bidirectional Unix socket pair closed by exec.

Linux and the supported BSDs set FD_CLOEXEC atomically at creation. On platforms without SOCK_CLOEXEC, notably macOS, this uses socketpair followed by fcntl; callers must therefore create the pair before starting threads that could concurrently call exec.

ยงErrors

Returns the operating-system error from socketpair or fcntl.