authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-03-04 03:59:03 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-03-04 03:59:03 -08:00
log317195b0721ffa96188965aed779a62c504f812e
tree6fa0b8836d36eda104b6207654663aa1de9d875a
parentae3e52c61e26720f694af0e9f08c8ae7365817a0
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

add sendfile


2 files changed, 8 insertions(+), 0 deletions(-)

mod.zig+7
......@@ -2649,6 +2649,7 @@ pub const libc = struct {
26492649 pub extern fn gettid() pid_t;
26502650 pub extern fn accept4(socket: c_int, noalias address: ?*struct_sockaddr, noalias address_len: *socklen_t, flags: c_int) c_int;
26512651 pub extern fn memfd_create(name: [*:0]const u8, flags: c_uint) c_int;
2652 pub extern fn sendfile(out_fd: c_int, in_fd: c_int, offset: ?*const off_t, count: usize) isize;
26522653};
26532654
26542655pub const clock_t = c_long;
......@@ -3176,3 +3177,9 @@ pub fn getsockname(socketfd: c_uint, noalias address: *struct_sockaddr, noalias
31763177 if (rc == -1) return errno.fromInt(errno.fromLibC());
31773178 std.debug.assert(rc == 0);
31783179}
3180pub fn sendfile(out_fd: c_int, in_fd: c_int, offset: ?*const off_t, count: usize) errno.Error!usize {
3181 const rc = libc.sendfile(out_fd, in_fd, offset, count);
3182 if (rc == -1) return errno.fromInt(errno.fromLibC());
3183 std.debug.assert(rc >= 0);
3184 return @intCast(rc);
3185}
test.zig+1
......@@ -33,4 +33,5 @@ test {
3333 _ = &linux.write;
3434 _ = &linux.writev;
3535 _ = &linux.getsockname;
36 _ = &linux.sendfile;
3637}