pub fn dup(oldfd: RawFd) -> Result<RawFd>
Expand description
Create a copy of the specified file descriptor (see dup(2)).
The new file descriptor will have a new index but refer to the same resource as the old file descriptor and the old and new file descriptors may be used interchangeably. The new and old file descriptor share the same underlying resource, offset, and file status flags. The actual index used for the file descriptor will be the lowest fd index that is available.
The two file descriptors do not share file descriptor flags (e.g. OFlag::FD_CLOEXEC
).