Function nix::fcntl::copy_file_range [−][src]
pub fn copy_file_range(
fd_in: RawFd,
off_in: Option<&mut loff_t>,
fd_out: RawFd,
off_out: Option<&mut loff_t>,
len: usize
) -> Result<usize>
Expand description
Copy a range of data from one file to another
The copy_file_range
system call performs an in-kernel copy between
file descriptors fd_in
and fd_out
without the additional cost of
transferring data from the kernel to user space and then back into the
kernel. It copies up to len
bytes of data from file descriptor fd_in
to
file descriptor fd_out
, overwriting any data that exists within the
requested range of the target file.
If the off_in
and/or off_out
arguments are used, the values
will be mutated to reflect the new position within the file after
copying. If they are not used, the relevant filedescriptors will be seeked
to the new position.
On successful completion the number of bytes actually copied will be returned.