diff options
| author | LemonBoy <thatlemon@gmail.com> | 2020-09-22 13:18:40 +0200 |
|---|---|---|
| committer | LemonBoy <thatlemon@gmail.com> | 2020-11-05 16:10:15 +0100 |
| commit | 53433cdea2cee73caea52a6baa10dc7bc7f6da4d (patch) | |
| tree | be054df879f9fd491f0a2b9fc87f1af3ccff9d29 /lib/std/c/freebsd.zig | |
| parent | 4664eae1e40813fb50bab83247cc7391312e38cb (diff) | |
| download | zig-53433cdea2cee73caea52a6baa10dc7bc7f6da4d.tar.gz zig-53433cdea2cee73caea52a6baa10dc7bc7f6da4d.zip | |
Implement a fallback mechanism for posix_memalign
Do the alignment dance by ourselves whenever posix_memalign is not
available.
Don't try to use malloc as it has too many edge cases, figuring out
whether a block of memory is manually aligned by the mechanism above or
is directly coming from malloc becomes too hard to be valuable.
Diffstat (limited to 'lib/std/c/freebsd.zig')
| -rw-r--r-- | lib/std/c/freebsd.zig | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/std/c/freebsd.zig b/lib/std/c/freebsd.zig index 1545a0e153..8fa78b0d6f 100644 --- a/lib/std/c/freebsd.zig +++ b/lib/std/c/freebsd.zig @@ -13,6 +13,9 @@ 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 extern "c" fn posix_memalign(memptr: *?*c_void, alignment: usize, size: usize) c_int; +pub extern "c" fn malloc_usable_size(?*const c_void) usize; + pub const sf_hdtr = extern struct { headers: [*]const iovec_const, hdr_cnt: c_int, |
