Zig 0.17.0-dev (Split by item) This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig standard library.
std › Io › Uring › dirOpenDir Private Function dirOpenDir Doc Source Private Function std.Io.Uring.dirOpenDir
fn dirOpenDir (
userdata : ?*anyopaque ,
dir : Dir ,
sub_path : []const u8 ,
options : Dir .OpenOptions ,
) Dir .OpenError !Dir Params userdata : ?*anyopaque dir : Dir sub_path : []const u8 options : Dir .OpenOptions File Io/Uring.zig: 2731
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764 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 ), // EXCL unset.
error .FileBusy => return errnoBug (.TXTBSY ),
error .PathAlreadyExists => return errnoBug (.EXIST ), // Not creating.
error .OperationUnsupported => return errnoBug (.OPNOTSUPP ), // No TMPFILE, no locks.
error .ReadOnlyFileSystem => return errnoBug (.ROFS ), // Not creating.
else => |e | return e ,
},
};
}