rustix/fs/
sendfile.rs

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