feature. See also
. The project being documented here (as the example) is the Zig library itself.
Uring.realPath
fn realPath(
ev: *Evented,
sync: *CancelRegion.Sync,
fd: fd_t,
out_buffer: []u8,
) File.RealPathError!usize
File
Code
fn realPath(
ev: *Evented,
sync: *CancelRegion.Sync,
fd: fd_t,
out_buffer: []u8,
) File.RealPathError!usize {
_ = ev;
var procfs_buf: [std.fmt.count("/proc/self/fd/{d}\x00", .{std.math.minInt(fd_t)})]u8 = undefined;
const proc_path = std.fmt.bufPrintSentinel(&procfs_buf, "/proc/self/fd/{d}", .{fd}, 0) catch
unreachable;
while (true) {
try sync.cancel_region.await(.nothing);
const rc = linux.readlink(proc_path, out_buffer.ptr, out_buffer.len);
switch (linux.errno(rc)) {
.SUCCESS => return rc,
.INTR => {},
.ACCES => return error.AccessDenied,
.FAULT => |err| return errnoBug(err),
.IO => return error.FileSystem,
.LOOP => return error.SymLinkLoop,
.NAMETOOLONG => return error.NameTooLong,
.NOENT => return error.FileNotFound,
.NOMEM => return error.SystemResources,
.NOTDIR => return error.NotDir,
.ILSEQ => |err| return errnoBug(err),
else => |err| return unexpectedErrno(err),
}
}
}