authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-09-01 22:51:49-07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-09-01 22:51:49-07:00
logb349aa32b55aae4cf2ae56740003f8aff0394920
tree09fdede2cc1172886a6f2ecb86e41c017af583f2
parentb96e8bad94f53d5f426a32f237d9e8346f51b8f2
signature Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

add readlinkat


1 files changed, 8 insertions(+), 0 deletions(-)

sys_darwin.zig+8
......@@ -281,6 +281,7 @@ pub const libc = struct {
281281 pub extern fn getcwd(buf: [*]u8, size: usize) ?[*:0]u8;
282282 pub extern fn fchmod(fildes: c_int, mode: mode_t) c_int;
283283 pub extern fn faccessat(fd: c_int, path: [*:0]const u8, amode: c_int, flag: c_int) c_int;
284 pub extern fn readlinkat(fd: c_int, noalias path: [*:0]const u8, noalias buf: [*]u8, len: usize) isize;
284285};
285286
286287pub const natural_t = c_uint;
......@@ -575,3 +576,10 @@ pub fn faccessat(fd: c_int, path: [*:0]const u8, amode: c_int, flag: c_int) !voi
575576 if (rc == -1) return errno.fromInt(errno.fromLibC());
576577 std.debug.assert(rc == 0);
577578}
579pub fn readlinkat(dirfd: c_int, noalias path: [*:0]const u8, noalias buf: []u8) ![:0]u8 {
580 const rc = libc.readlinkat(dirfd, path, buf.ptr, buf.len);
581 if (rc == -1) return errno.fromInt(errno.fromLibC());
582 std.debug.assert(rc >= 0);
583 buf[@intCast(rc)] = 0;
584 return buf[0..@intCast(rc) :0];
585}