summaryrefslogtreecommitdiff
path: root/vendor/rustix/src/fs/sendfile.rs
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-07-02 18:36:06 -0600
committermo khan <mo@mokhan.ca>2025-07-02 18:36:06 -0600
commit8cdfa445d6629ffef4cb84967ff7017654045bc2 (patch)
tree22f0b0907c024c78d26a731e2e1f5219407d8102 /vendor/rustix/src/fs/sendfile.rs
parent4351c74c7c5f97156bc94d3a8549b9940ac80e3f (diff)
chore: add vendor directory
Diffstat (limited to 'vendor/rustix/src/fs/sendfile.rs')
-rw-r--r--vendor/rustix/src/fs/sendfile.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/vendor/rustix/src/fs/sendfile.rs b/vendor/rustix/src/fs/sendfile.rs
new file mode 100644
index 00000000..db3d6022
--- /dev/null
+++ b/vendor/rustix/src/fs/sendfile.rs
@@ -0,0 +1,20 @@
+use crate::{backend, io};
+use backend::fd::AsFd;
+
+/// `sendfile(out_fd, in_fd, offset, count)`—Transfer data between file
+/// descriptors.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/sendfile.2.html
+#[cfg(linux_kernel)]
+#[inline]
+pub fn sendfile<OutFd: AsFd, InFd: AsFd>(
+ out_fd: OutFd,
+ in_fd: InFd,
+ offset: Option<&mut u64>,
+ count: usize,
+) -> io::Result<usize> {
+ backend::fs::syscalls::sendfile(out_fd.as_fd(), in_fd.as_fd(), offset, count)
+}