| author | |
| committer | |
| log | 761602e3e84afee1a77daf9f850c67cb8e25f7ed |
| tree | c1e72f6ea4febdebd773eab186653edcdf600fd6 |
| parent | 336ed03f0f4ffde8e60fb8b4859c0c2158511338 |
* Use the correct versioned libc calls to avoid nasty surprises3 files changed, 17 insertions(+), 9 deletions(-)
lib/std/c/netbsd.zig+2-3| ... | ... | @@ -6,15 +6,14 @@ usingnamespace std.c; |
| 6 | 6 | extern "c" fn __errno() *c_int; |
| 7 | 7 | pub const _errno = __errno; |
| 8 | 8 | |
| 9 | pub extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) usize; | |
| 10 | pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int; | |
| 11 | ||
| 12 | 9 | pub const dl_iterate_phdr_callback = extern fn (info: *dl_phdr_info, size: usize, data: ?*c_void) c_int; |
| 13 | 10 | pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*c_void) c_int; |
| 14 | 11 | |
| 15 | 12 | pub extern "c" fn __fstat50(fd: fd_t, buf: *Stat) c_int; |
| 16 | 13 | pub extern "c" fn __clock_gettime50(clk_id: c_int, tp: *timespec) c_int; |
| 17 | 14 | pub extern "c" fn __clock_getres50(clk_id: c_int, tp: *timespec) c_int; |
| 15 | pub extern "c" fn __getdents30(fd: c_int, buf_ptr: [*]u8, nbytes: usize) c_int; | |
| 16 | pub extern "c" fn __sigaltstack14(ss: ?*stack_t, old_ss: ?*stack_t) c_int; | |
| 18 | 17 | |
| 19 | 18 | pub const pthread_mutex_t = extern struct { |
| 20 | 19 | ptm_magic: c_uint = 0x33330003, |
lib/std/fs.zig+4-6| ... | ... | @@ -339,12 +339,10 @@ pub const Dir = struct { |
| 339 | 339 | fn nextBsd(self: *Self) !?Entry { |
| 340 | 340 | start_over: while (true) { |
| 341 | 341 | if (self.index >= self.end_index) { |
| 342 | const rc = os.system.getdirentries( | |
| 343 | self.dir.fd, | |
| 344 | &self.buf, | |
| 345 | self.buf.len, | |
| 346 | &self.seek, | |
| 347 | ); | |
| 342 | const rc = if (builtin.os.tag == .netbsd) | |
| 343 | os.system.__getdents30(self.dir.fd, &self.buf, self.buf.len) | |
| 344 | else | |
| 345 | os.system.getdents(self.dir.fd, &self.buf, self.buf.len); | |
| 348 | 346 | switch (os.errno(rc)) { |
| 349 | 347 | 0 => {}, |
| 350 | 348 | os.EBADF => unreachable, // Dir is invalid or was opened without iteration ability |
lib/std/os.zig+11| ... | ... | @@ -3522,6 +3522,17 @@ pub fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) SigaltstackError!void { |
| 3522 | 3522 | if (builtin.os.tag == .windows or builtin.os.tag == .uefi or builtin.os.tag == .wasi) |
| 3523 | 3523 | @compileError("std.os.sigaltstack not available for this target"); |
| 3524 | 3524 | |
| 3525 | if (std.Target.current.os.tag == .netbsd) { | |
| 3526 | switch (errno(system.__sigaltstack14(ss, old_ss))) { | |
| 3527 | 0 => return, | |
| 3528 | EFAULT => unreachable, | |
| 3529 | EINVAL => unreachable, | |
| 3530 | ENOMEM => return error.SizeTooSmall, | |
| 3531 | EPERM => return error.PermissionDenied, | |
| 3532 | else => |err| return unexpectedErrno(err), | |
| 3533 | } | |
| 3534 | } | |
| 3535 | ||
| 3525 | 3536 | switch (errno(system.sigaltstack(ss, old_ss))) { |
| 3526 | 3537 | 0 => return, |
| 3527 | 3538 | EFAULT => unreachable, |