Trait creusot_contracts::std::os::linux::net::UnixSocketExt

source ·
pub trait UnixSocketExt: Sealed {
    // Required methods
    fn passcred(&self) -> Result<bool, Error>;
    fn set_passcred(&self, passcred: bool) -> Result<(), Error>;
}
🔬This is a nightly-only experimental API. (unix_socket_ancillary_data)
Available on Linux only.
Expand description

Linux-specific functionality for AF_UNIX sockets UnixDatagram and UnixStream.

Required Methods§

source

fn passcred(&self) -> Result<bool, Error>

🔬This is a nightly-only experimental API. (unix_socket_ancillary_data)

Query the current setting of socket option SO_PASSCRED.

source

fn set_passcred(&self, passcred: bool) -> Result<(), Error>

🔬This is a nightly-only experimental API. (unix_socket_ancillary_data)

Enable or disable socket option SO_PASSCRED.

This option enables the credentials of the sending process to be received as a control message in AncillaryData.

§Examples
#![feature(unix_socket_ancillary_data)]
use std::os::linux::net::UnixSocketExt;
use std::os::unix::net::UnixDatagram;

fn main() -> std::io::Result<()> {
    let sock = UnixDatagram::unbound()?;
    sock.set_passcred(true).expect("set_passcred failed");
    Ok(())
}

Implementors§