nix::unistd

Function dup3_raw

Source
pub unsafe fn dup3_raw<Fd1: AsFd, Fd2: IntoRawFd>(
    oldfd: Fd1,
    newfd: Fd2,
    flags: OFlag,
) -> Result<OwnedFd>
Expand description

Create a new copy of the specified file descriptor using the specified fd and flags.

This function behaves similar to dup3() except for it allows you to specify arbitrary fd values.

§Safety

Since this function returns an OwnedFd, you have to ensure that the returned OwnedFd is the ONLY owner of the file descriptor specified newfd. Otherwise, double close could happen.

For more information, see the documentation of dup2_raw().

§References

§See also