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 › filePathKind Private Function filePathKind Doc Source Private Function std.Io.Threaded.filePathKind
fn filePathKind (t : *Threaded , dir : Dir , sub_path : []const u8 ) !File .Kind Params File Io/Threaded.zig: 3868
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901 fn filePathKind (t : *Threaded , dir : Dir , sub_path : []const u8 ) !File .Kind {
if (native_os == .linux ) {
var path_buffer : [posix .PATH_MAX ]u8 = undefined ;
const sub_path_posix = try pathToPosix (sub_path , &path_buffer );
const linux = std .os .linux ;
const syscall : Syscall = try .start ();
while (true ) {
var statx = std .mem .zeroes (linux .Statx );
switch (linux .errno (linux .statx (
dir .handle ,
sub_path_posix ,
linux .AT .NO_AUTOMOUNT | linux .AT .SYMLINK_NOFOLLOW ,
.{ .TYPE = true },
&statx ,
))) {
.SUCCESS => {
syscall .finish ();
if (!statx .mask .TYPE ) return error .Unexpected ;
return statxKind (statx .mode );
},
.INTR => {
try syscall .checkCancel ();
continue ;
},
.NOMEM => return syscall .fail (error .SystemResources ),
else => |err | return syscall .unexpectedErrno (err ),
}
}
}
const stat = try dirStatFile (t , dir , sub_path , .{ .follow_symlinks = false });
return stat .kind ;
}