Skip to content

Commit 419a976

Browse files
authored
Rollup merge of #1944 - nroi:include-sendfile64, r=JohnTitor
Include sendfile64() for Linux `sendfile` uses the `off_t` type, which is platform dependent. On 64-bit architectures, I can pass an `off64_t` as the third argument to `libc::sendfile`, but on 32-bit architectures, this does not compile. `sendfile64` on the other hand uses a 64-bit wide offset even on 32-bit architectures, so that `off64_t` can be used. Excerpt from `man 2 sendfile`: > The original Linux sendfile() system call was not designed to handle large file offsets. Consequently, Linux 2.4 added sendfile64(), with a wider type for the offset argument. I hope that supporting Linux versions below 2.4 is not a requirement for libc.
2 parents fd266e0 + a8c1d97 commit 419a976

File tree

1 file changed

+6
-0
lines changed
  • src/unix/linux_like/linux

1 file changed

+6
-0
lines changed

src/unix/linux_like/linux/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3230,6 +3230,12 @@ extern "C" {
32303230
offset: *mut off_t,
32313231
count: ::size_t,
32323232
) -> ::ssize_t;
3233+
pub fn sendfile64(
3234+
out_fd: ::c_int,
3235+
in_fd: ::c_int,
3236+
offset: *mut off64_t,
3237+
count: ::size_t,
3238+
) -> ::ssize_t;
32333239
pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int;
32343240
pub fn getgrgid_r(
32353241
gid: ::gid_t,

0 commit comments

Comments
 (0)