Skip to main content

split_fds_into_frames

Function split_fds_into_frames 

Source
pub fn split_fds_into_frames(
    fds: Vec<OwnedFd>,
    seed: u64,
    more: bool,
) -> Result<Vec<Vec<OwnedFd>>, (Vec<OwnedFd>, FdLimitError)>
Expand description

Partition a complete fd array into transport frames.

When more is true the fds are split across compute_n_frames(seed, n) batches (≥3 for test hardening, cap-limited to ≤MAX_FDS_PER_FRAME per frame).

When more is false all fds must fit in a single frame. If the total count exceeds MAX_FDS_PER_FRAME the fds are returned intact inside an [Err(FdLimitError)] so they can be dropped cleanly by the caller before returning an error reply.

§Returns

Ok(Vec<Vec<OwnedFd>>) — one inner vec per transport frame (1…N frames). Err(FdLimitError { fds, .. }) — the original fds are returned so the caller can drop them; the error contains the count and cap for a diagnostic.