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 › fileStatWasi Private Function fileStatWasi Doc Source Private Function std.Io.Threaded.fileStatWasi
fn fileStatWasi (userdata : ?*anyopaque , file : File ) File .StatError !File .Stat Params userdata : ?*anyopaque file : File File Io/Threaded.zig: 4135
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166 fn fileStatWasi (userdata : ?*anyopaque , file : File ) File .StatError !File .Stat {
if (builtin .link_libc ) return fileStatPosix (userdata , file );
const t : *Threaded = @ptrCast (@alignCast (userdata ));
_ = t ;
const syscall : Syscall = try .start ();
while (true ) {
var stat : std .os .wasi .filestat_t = undefined ;
switch (std .os .wasi .fd_filestat_get (file .handle , &stat )) {
.SUCCESS => {
syscall .finish ();
return statFromWasi (&stat );
},
.INTR => {
try syscall .checkCancel ();
continue ;
},
else => |e | {
syscall .finish ();
switch (e ) {
.INVAL => |err | return errnoBug (err ),
.BADF => |err | return errnoBug (err ), // File descriptor used after closed.
.NOMEM => return error .SystemResources ,
.ACCES => return error .AccessDenied ,
.NOTCAPABLE => return error .AccessDenied ,
else => |err | return posix .unexpectedErrno (err ),
}
},
}
}
}