feature. See also
. The project being documented here (as the example) is the Zig library itself.
Uring.dirOpenDir
fn dirOpenDir(
userdata: ?*anyopaque,
dir: Dir,
sub_path: []const u8,
options: Dir.OpenOptions,
) Dir.OpenError!Dir
File
Code
fn dirOpenDir(
userdata: ?*anyopaque,
dir: Dir,
sub_path: []const u8,
options: Dir.OpenOptions,
) Dir.OpenError!Dir {
const ev: *Evented = @ptrCast(@alignCast(userdata));
var path_buffer: [PATH_MAX]u8 = undefined;
const sub_path_posix = try pathToPosix(sub_path, &path_buffer);
var cancel_region: CancelRegion = .init();
defer cancel_region.deinit();
return .{
.handle = ev.openat(&cancel_region, dir.handle, sub_path_posix, .{
.ACCMODE = .RDONLY,
.DIRECTORY = true,
.NOFOLLOW = !options.follow_symlinks,
.CLOEXEC = true,
.PATH = !options.iterate,
}, 0) catch |err| switch (err) {
error.IsDir => return errnoBug(.ISDIR),
error.WouldBlock => return errnoBug(.AGAIN),
error.FileTooBig => return errnoBug(.FBIG),
error.NoSpaceLeft => return errnoBug(.NOSPC),
error.DeviceBusy => return errnoBug(.BUSY),
error.FileBusy => return errnoBug(.TXTBSY),
error.PathAlreadyExists => return errnoBug(.EXIST),
error.OperationUnsupported => return errnoBug(.OPNOTSUPP),
error.ReadOnlyFileSystem => return errnoBug(.ROFS),
else => |e| return e,
},
};
}