| ... | @@ -2649,6 +2649,7 @@ pub const libc = struct { | ... | @@ -2649,6 +2649,7 @@ pub const libc = struct { |
| 2649 | pub extern fn gettid() pid_t; | 2649 | pub extern fn gettid() pid_t; |
| 2650 | pub extern fn accept4(socket: c_int, noalias address: ?*struct_sockaddr, noalias address_len: *socklen_t, flags: c_int) c_int; | 2650 | pub extern fn accept4(socket: c_int, noalias address: ?*struct_sockaddr, noalias address_len: *socklen_t, flags: c_int) c_int; |
| 2651 | pub extern fn memfd_create(name: [*:0]const u8, flags: c_uint) c_int; | 2651 | 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; |
| 2652 | }; | 2653 | }; |
| 2653 | | 2654 | |
| 2654 | pub const clock_t = c_long; | 2655 | pub const clock_t = c_long; |
| ... | @@ -3176,3 +3177,9 @@ pub fn getsockname(socketfd: c_uint, noalias address: *struct_sockaddr, noalias | ... | @@ -3176,3 +3177,9 @@ pub fn getsockname(socketfd: c_uint, noalias address: *struct_sockaddr, noalias |
| 3176 | if (rc == -1) return errno.fromInt(errno.fromLibC()); | 3177 | if (rc == -1) return errno.fromInt(errno.fromLibC()); |
| 3177 | std.debug.assert(rc == 0); | 3178 | std.debug.assert(rc == 0); |
| 3178 | } | 3179 | } |
| | 3180 | pub 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 | } |