# Function rustix::io::dup3

source · [−]

    pub fn dup3<Fd: AsFd>(fd: Fd, new: &mut OwnedFd, flags: DupFlags) -> Result<()>

Expand description

`dup3(fd, new, flags)`—Changes the file description of a 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

- Linux