Skip to main content

uds_sendmsg_with_creds

Function uds_sendmsg_with_creds 

Source
pub async fn uds_sendmsg_with_creds(
    socket: &UnixDatagram,
    payload: &[u8],
    credentials: &ProcessCredentials,
) -> Result<usize>
Expand description

Sends data to the Unix domain socket.

This function is specifically for connected Unix domain sockets in datagram mode (that’s, SOCK_DGRAM), which are represented via UnixDatagram in tokio.

The payload is sent with an SCM_CREDENTIALS ancillary block using the provided ProcessCredentials.

Linux permits a sender to use its own PID, UID, and GID normally. Sending a forged PID requires CAP_SYS_ADMIN, sending a forged UID requires CAP_SETUID, and sending a forged GID requires CAP_SETGID.

§Errors

If socket readiness or the underlying system call fails, an error is returned.