Function dup3_raw

unsafe fn dup3_raw<Fd1: std::os::fd::AsFd, Fd2: std::os::fd::IntoRawFd>(oldfd: Fd1, newfd: Fd2, flags: OFlag) -> Result<OwnedFd>

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