| 1 |
use crate::{backend, io}; |
| 2 |
use backend::fd::AsFd; |
| 3 |
|
| 4 |
/// `sendfile(out_fd, in_fd, offset, count)`—Transfer data between file |
| 5 |
/// descriptors. |
| 6 |
/// |
| 7 |
/// # References |
| 8 |
/// - [Linux] |
| 9 |
/// |
| 10 |
/// [Linux]: https://man7.org/linux/man-pages/man2/sendfile.2.html |
| 11 |
#[cfg(linux_kernel)] |
| 12 |
#[inline] |
| 13 |
pub fn sendfile<OutFd: AsFd, InFd: AsFd>( |
| 14 |
out_fd: OutFd, |
| 15 |
in_fd: InFd, |
| 16 |
offset: Option<&mut u64>, |
| 17 |
count: usize, |
| 18 |
) -> io::Result<usize> { |
| 19 |
backend::fs::syscalls::sendfile(out_fd.as_fd(), in_fd.as_fd(), offset, count) |
| 20 |
} |