authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-02-15 16:44:45 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-02-15 16:44:45 -08:00
log15f2610d55de464f9448a4557c03fe191d6faeac
treed066fdcd6746158b1761ac45544637f8f0c944b4
parentbe2fd8e7a40a739325faba750c606ecb8f779c00

add Dir.readlink(path)


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

Dir.zig+9
...@@ -8,6 +8,11 @@ const Dir = @This();...@@ -8,6 +8,11 @@ const Dir = @This();
88
9const os = builtin.target.os.tag;9const os = builtin.target.os.tag;
1010
11const sys = switch (os) {
12 .linux => sys_linux,
13 else => unreachable,
14};
15
11fd: nfs.Handle,16fd: nfs.Handle,
1217
13// Resource allocation may fail; resource deallocation must succeed.18// Resource allocation may fail; resource deallocation must succeed.
...@@ -105,3 +110,7 @@ pub fn makeOpenPath(self: Dir, sub_path: [:0]const u8, flags: OpenDirFlags) !Dir...@@ -105,3 +110,7 @@ pub fn makeOpenPath(self: Dir, sub_path: [:0]const u8, flags: OpenDirFlags) !Dir
105 else => |e| return e,110 else => |e| return e,
106 };111 };
107}112}
113
114pub fn readlink(self: Dir, noalias sub_path: [:0]const u8, noalias buf: []u8) ![:0]u8 {
115 return sys.readlinkat(@intFromEnum(self.fd), sub_path, buf);
116}