diff options
| author | Terin Stock <terinjokes@gmail.com> | 2020-01-10 02:03:56 -0800 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-03-02 12:54:50 -0500 |
| commit | bd287dd1942f0a72e6bd9dc8475bd4e7d34fa5f8 (patch) | |
| tree | 7288fbd6c28ee5b67e880f2bf7f4c0bc2f269377 /lib/std/c/freebsd.zig | |
| parent | 00be934569d25e3b041091ff63a4cf6c456d1403 (diff) | |
| download | zig-bd287dd1942f0a72e6bd9dc8475bd4e7d34fa5f8.tar.gz zig-bd287dd1942f0a72e6bd9dc8475bd4e7d34fa5f8.zip | |
std: implement sendfile on linux
This changset adds a `sendfile(2)` syscall bindings to the linux bits
component. Where available, the `sendfile64(2)` syscall will be
transparently called.
A wrapping function has also been added to the std.os to transform
errno returns to Zig errors.
Change-Id: I86769fc4382c0771e3656e7b21137bafd99a4411
Diffstat (limited to 'lib/std/c/freebsd.zig')
| -rw-r--r-- | lib/std/c/freebsd.zig | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/std/c/freebsd.zig b/lib/std/c/freebsd.zig index 4c6614c978..e7d924ddbf 100644 --- a/lib/std/c/freebsd.zig +++ b/lib/std/c/freebsd.zig @@ -8,6 +8,14 @@ pub extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) usize; pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int; pub extern "c" fn getrandom(buf_ptr: [*]u8, buf_len: usize, flags: c_uint) isize; +pub const sf_hdtr = extern struct { + headers: [*]iovec_const, + hdr_cnt: c_int, + trailers: [*]iovec_const, + trl_cnt: c_int, +}; +pub extern "c" fn sendfile(fd: c_int, s: c_int, offset: u64, nbytes: usize, sf_hdtr: ?*sf_hdtr, sbytes: ?*u64, flags: c_int) c_int; + pub const dl_iterate_phdr_callback = extern fn (info: *dl_phdr_info, size: usize, data: ?*c_void) c_int; pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*c_void) c_int; |
