| 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,15 +6,14 @@ usingnamespace std.c; |
| 6 | extern "c" fn __errno() *c_int; | 6 | extern "c" fn __errno() *c_int; |
| 7 | pub const _errno = __errno; | 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 | pub const dl_iterate_phdr_callback = extern fn (info: *dl_phdr_info, size: usize, data: ?*c_void) c_int; | 9 | pub const dl_iterate_phdr_callback = extern fn (info: *dl_phdr_info, size: usize, data: ?*c_void) c_int; |
| 13 | pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*c_void) c_int; | 10 | pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*c_void) c_int; |
| 14 | 11 | ||
| 15 | pub extern "c" fn __fstat50(fd: fd_t, buf: *Stat) c_int; | 12 | pub extern "c" fn __fstat50(fd: fd_t, buf: *Stat) c_int; |
| 16 | pub extern "c" fn __clock_gettime50(clk_id: c_int, tp: *timespec) c_int; | 13 | pub extern "c" fn __clock_gettime50(clk_id: c_int, tp: *timespec) c_int; |
| 17 | pub extern "c" fn __clock_getres50(clk_id: c_int, tp: *timespec) c_int; | 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 | pub const pthread_mutex_t = extern struct { | 18 | pub const pthread_mutex_t = extern struct { |
| 20 | ptm_magic: c_uint = 0x33330003, | 19 | ptm_magic: c_uint = 0x33330003, |
lib/std/fs.zig+4-6| ... | @@ -339,12 +339,10 @@ pub const Dir = struct { | ... | @@ -339,12 +339,10 @@ pub const Dir = struct { |
| 339 | fn nextBsd(self: *Self) !?Entry { | 339 | fn nextBsd(self: *Self) !?Entry { |
| 340 | start_over: while (true) { | 340 | start_over: while (true) { |
| 341 | if (self.index >= self.end_index) { | 341 | if (self.index >= self.end_index) { |
| 342 | const rc = os.system.getdirentries( | 342 | const rc = if (builtin.os.tag == .netbsd) |
| 343 | self.dir.fd, | 343 | os.system.__getdents30(self.dir.fd, &self.buf, self.buf.len) |
| 344 | &self.buf, | 344 | else |
| 345 | self.buf.len, | 345 | os.system.getdents(self.dir.fd, &self.buf, self.buf.len); |
| 346 | &self.seek, | ||
| 347 | ); | ||
| 348 | switch (os.errno(rc)) { | 346 | switch (os.errno(rc)) { |
| 349 | 0 => {}, | 347 | 0 => {}, |
| 350 | os.EBADF => unreachable, // Dir is invalid or was opened without iteration ability | 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,6 +3522,17 @@ pub fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) SigaltstackError!void { |
| 3522 | if (builtin.os.tag == .windows or builtin.os.tag == .uefi or builtin.os.tag == .wasi) | 3522 | if (builtin.os.tag == .windows or builtin.os.tag == .uefi or builtin.os.tag == .wasi) |
| 3523 | @compileError("std.os.sigaltstack not available for this target"); | 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 | switch (errno(system.sigaltstack(ss, old_ss))) { | 3536 | switch (errno(system.sigaltstack(ss, old_ss))) { |
| 3526 | 0 => return, | 3537 | 0 => return, |
| 3527 | EFAULT => unreachable, | 3538 | EFAULT => unreachable, |