Macro rustix::net::cmsg_space

source ·
macro_rules! cmsg_space {
    (ScmRights($len:expr)) => { ... };
    (ScmCredentials($len:expr)) => { ... };
    ($firstid:ident($firstex:expr), $($restid:ident($restex:expr)),*) => { ... };
}
Expand description

Macro for defining the amount of space to allocate in a buffer for use with RecvAncillaryBuffer::new and SendAncillaryBuffer::new.

§Examples

Allocate a buffer for a single file descriptor:

let mut space = [0; rustix::cmsg_space!(ScmRights(1))];

Allocate a buffer for credentials:

let mut space = [0; rustix::cmsg_space!(ScmCredentials(1))];

Allocate a buffer for two file descriptors and credentials:

let mut space = [0; rustix::cmsg_space!(ScmRights(2), ScmCredentials(1))];