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 › posixFchown Private Function posixFchown Doc Source Private Function std.Io.Threaded.posixFchown
fn posixFchown (fd : posix .fd_t , uid : posix .uid_t , gid : posix .gid_t ) File .SetOwnerError !void Params File Io/Threaded.zig: 8688
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717 fn posixFchown (fd : posix .fd_t , uid : posix .uid_t , gid : posix .gid_t ) File .SetOwnerError !void {
comptime assert (have_fchown );
const syscall : Syscall = try .start ();
while (true ) {
switch (posix .errno (posix .system .fchown (fd , uid , gid ))) {
.SUCCESS => return syscall .finish (),
.INTR => {
try syscall .checkCancel ();
continue ;
},
else => |e | {
syscall .finish ();
switch (e ) {
.BADF => |err | return errnoBug (err ), // likely fd refers to directory opened without `Dir.OpenOptions.iterate`
.FAULT => |err | return errnoBug (err ),
.INVAL => |err | return errnoBug (err ),
.ACCES => return error .AccessDenied ,
.IO => return error .InputOutput ,
.LOOP => return error .SymLinkLoop ,
.NOENT => return error .FileNotFound ,
.NOMEM => return error .SystemResources ,
.NOTDIR => return error .FileNotFound ,
.PERM => return error .PermissionDenied ,
.ROFS => return error .ReadOnlyFileSystem ,
else => |err | return posix .unexpectedErrno (err ),
}
},
}
}
}