xref: /third_party/rust/crates/rustix/src/fs/copy_file_range.rs
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/rust/crates/rustix/src/fs/
1b8a62b91Sopenharmony_ciuse crate::{backend, io};
2b8a62b91Sopenharmony_ciuse backend::fd::AsFd;
3b8a62b91Sopenharmony_ci
4b8a62b91Sopenharmony_ci/// `copy_file_range(fd_in, off_in, fd_out, off_out, len, 0)`—Copies data
5b8a62b91Sopenharmony_ci/// from one file to another.
6b8a62b91Sopenharmony_ci///
7b8a62b91Sopenharmony_ci/// # References
8b8a62b91Sopenharmony_ci///  - [Linux]
9b8a62b91Sopenharmony_ci///
10b8a62b91Sopenharmony_ci/// [Linux]: https://man7.org/linux/man-pages/man2/copy_file_range.2.html
11b8a62b91Sopenharmony_ci#[inline]
12b8a62b91Sopenharmony_cipub fn copy_file_range<InFd: AsFd, OutFd: AsFd>(
13b8a62b91Sopenharmony_ci    fd_in: InFd,
14b8a62b91Sopenharmony_ci    off_in: Option<&mut u64>,
15b8a62b91Sopenharmony_ci    fd_out: OutFd,
16b8a62b91Sopenharmony_ci    off_out: Option<&mut u64>,
17b8a62b91Sopenharmony_ci    len: u64,
18b8a62b91Sopenharmony_ci) -> io::Result<u64> {
19b8a62b91Sopenharmony_ci    backend::fs::syscalls::copy_file_range(fd_in.as_fd(), off_in, fd_out.as_fd(), off_out, len)
20b8a62b91Sopenharmony_ci}
21

Indexes created Thu Nov 07 10:32:03 CST 2024