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 › Threaded › dirReadLinkWasi Private Function dirReadLinkWasi Doc Source Private Function std.Io.Threaded.dirReadLinkWasi
fn dirReadLinkWasi (dir : Dir , sub_path : []const u8 , buffer : []u8 ) Dir .ReadLinkError !usize Params dir : Dir sub_path : []const u8 buffer : []u8 File Io/Threaded.zig: 8353
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387 fn dirReadLinkWasi (dir : Dir , sub_path : []const u8 , buffer : []u8 ) Dir .ReadLinkError !usize {
if (builtin .link_libc ) return dirReadLinkPosix (dir , sub_path , buffer );
var n : usize = undefined ;
const syscall : Syscall = try .start ();
while (true ) {
switch (std .os .wasi .path_readlink (dir .handle , sub_path .ptr , sub_path .len , buffer .ptr , buffer .len , &n )) {
.SUCCESS => {
syscall .finish ();
return n ;
},
.INTR => {
try syscall .checkCancel ();
continue ;
},
else => |e | {
syscall .finish ();
switch (e ) {
.ACCES => return error .AccessDenied ,
.FAULT => |err | return errnoBug (err ),
.INVAL => return error .NotLink ,
.IO => return error .FileSystem ,
.LOOP => return error .SymLinkLoop ,
.NAMETOOLONG => return error .NameTooLong ,
.NOENT => return error .FileNotFound ,
.NOMEM => return error .SystemResources ,
.NOTDIR => return error .NotDir ,
.NOTCAPABLE => return error .AccessDenied ,
.ILSEQ => return error .BadPathName ,
else => |err | return posix .unexpectedErrno (err ),
}
},
}
}
}