aboutsummaryrefslogtreecommitdiff
path: root/std/os/path.zig
diff options
context:
space:
mode:
Diffstat (limited to 'std/os/path.zig')
-rw-r--r--std/os/path.zig11
1 files changed, 10 insertions, 1 deletions
diff --git a/std/os/path.zig b/std/os/path.zig
index 0d636353a8..af767b0dca 100644
--- a/std/os/path.zig
+++ b/std/os/path.zig
@@ -1188,6 +1188,15 @@ pub fn realC(out_buffer: *[os.MAX_PATH_BYTES]u8, pathname: [*]const u8) RealErro
return os.readLinkC(out_buffer, proc_path.ptr);
},
+ Os.freebsd => { // XXX requires fdescfs
+ const fd = try os.posixOpenC(pathname, posix.O_PATH | posix.O_NONBLOCK | posix.O_CLOEXEC, 0);
+ defer os.close(fd);
+
+ var buf: ["/dev/fd/-2147483648\x00".len]u8 = undefined;
+ const proc_path = fmt.bufPrint(buf[0..], "/dev/fd/{}\x00", fd) catch unreachable;
+
+ return os.readLinkC(out_buffer, proc_path.ptr);
+ },
else => @compileError("TODO implement os.path.real for " ++ @tagName(builtin.os)),
}
}
@@ -1202,7 +1211,7 @@ pub fn real(out_buffer: *[os.MAX_PATH_BYTES]u8, pathname: []const u8) RealError!
const pathname_w = try windows_util.sliceToPrefixedFileW(pathname);
return realW(out_buffer, &pathname_w);
},
- Os.macosx, Os.ios, Os.linux => {
+ Os.macosx, Os.ios, Os.linux, Os.freebsd => {
const pathname_c = try os.toPosixPath(pathname);
return realC(out_buffer, &pathname_c);
},