authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2020-06-23 17:45:31+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2020-06-24 21:00:21+02:00
logc63b23d684ded6ad7e740df87b1aedde0bec399d
tree127e66eab2bf7b57dc8b5f21df20b49008e16517
parentbe78b7b648fdda7e0b052aa96eb4551edc64ef18

Use fstatat on macOS (otherwise uses 32bit)


2 files changed, 3 insertions(+), 1 deletions(-)

lib/std/c.zig+2-1
......@@ -73,7 +73,6 @@ pub extern "c" fn abort() noreturn;
7373pub extern "c" fn exit(code: c_int) noreturn;
7474pub extern "c" fn isatty(fd: fd_t) c_int;
7575pub extern "c" fn close(fd: fd_t) c_int;
76pub extern "c" fn fstatat(dirfd: fd_t, path: [*:0]const u8, stat_buf: *Stat, flags: u32) c_int;
7776pub extern "c" fn lseek(fd: fd_t, offset: off_t, whence: c_int) off_t;
7877pub extern "c" fn open(path: [*:0]const u8, oflag: c_uint, ...) c_int;
7978pub extern "c" fn openat(fd: c_int, path: [*:0]const u8, oflag: c_uint, ...) c_int;
......@@ -116,9 +115,11 @@ pub extern "c" fn readlinkat(dirfd: fd_t, noalias path: [*:0]const u8, noalias b
116115pub usingnamespace switch (builtin.os.tag) {
117116 .macosx, .ios, .watchos, .tvos => struct {
118117 pub const realpath = @"realpath$DARWIN_EXTSN";
118 pub const fstatat = @"fstatat$INODE64";
119119 },
120120 else => struct {
121121 pub extern "c" fn realpath(noalias file_name: [*:0]const u8, noalias resolved_name: [*]u8) ?[*:0]u8;
122 pub extern "c" fn fstatat(dirfd: fd_t, path: [*:0]const u8, stat_buf: *Stat, flags: u32) c_int;
122123 },
123124};
124125
lib/std/c/darwin.zig+1
......@@ -16,6 +16,7 @@ pub extern "c" fn @"realpath$DARWIN_EXTSN"(noalias file_name: [*:0]const u8, noa
1616
1717pub extern "c" fn __getdirentries64(fd: c_int, buf_ptr: [*]u8, buf_len: usize, basep: *i64) isize;
1818pub extern "c" fn @"fstat$INODE64"(fd: fd_t, buf: *Stat) c_int;
19pub extern "c" fn @"fstatat$INODE64"(dirfd: fd_t, path_name: [*:0]const u8, buf: *Stat, flags: u32) c_int;
1920
2021pub extern "c" fn mach_absolute_time() u64;
2122pub extern "c" fn mach_timebase_info(tinfo: ?*mach_timebase_info_data) void;