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 › dirOpenDirHaiku Private Function dirOpenDirHaiku Doc Source Private Function std.Io.Threaded.dirOpenDirHaiku
fn dirOpenDirHaiku (
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/Threaded.zig: 5427
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475 fn dirOpenDirHaiku (
userdata : ?*anyopaque ,
dir : Dir ,
sub_path : []const u8 ,
options : Dir .OpenOptions ,
) Dir .OpenError !Dir {
const t : *Threaded = @ptrCast (@alignCast (userdata ));
_ = t ;
var path_buffer : [posix .PATH_MAX ]u8 = undefined ;
const sub_path_posix = try pathToPosix (sub_path , &path_buffer );
_ = options ;
const syscall : Syscall = try .start ();
while (true ) {
const rc = posix .system ._kern_open_dir (dir .handle , sub_path_posix );
if (rc >= 0 ) {
syscall .finish ();
return .{ .handle = rc };
}
switch (@as (posix .E , @fromBackingInt (@intCast (rc )))) {
.INTR => {
try syscall .checkCancel ();
continue ;
},
else => |e | {
syscall .finish ();
switch (e ) {
.FAULT => |err | return errnoBug (err ),
.INVAL => |err | return errnoBug (err ),
.BADF => |err | return errnoBug (err ), // File descriptor used after closed.
.ACCES => return error .AccessDenied ,
.LOOP => return error .SymLinkLoop ,
.MFILE => return error .ProcessFdQuotaExceeded ,
.NAMETOOLONG => return error .NameTooLong ,
.NFILE => return error .SystemFdQuotaExceeded ,
.NODEV => return error .NoDevice ,
.NOENT => return error .FileNotFound ,
.NOMEM => return error .SystemResources ,
.NOTDIR => return error .NotDir ,
.PERM => return error .PermissionDenied ,
.BUSY => |err | return errnoBug (err ),
else => |err | return posix .unexpectedErrno (err ),
}
},
}
}
}