Function rustix::io::dup3

source · []
pub fn dup3<Fd: AsFd>(fd: Fd, new: &OwnedFd, flags: DupFlags) -> Result<()>
Expand description

dup3(fd, new, flags)—Creates a new OwnedFd instance that shares the same underlying file description as the existing OwnedFd instance, closing new and reusing its file descriptor, with flags.

dup3 is the same as dup2 but adds an additional flags operand, and it fails in the case that fd and new have the same file descriptor value. This additional difference is the reason this function isn’t named dup2_with.

References