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 library itself.
Zig › std/ › Io/ › Threaded.zig › fileSyncPosix
fileSyncPosix
Threaded.fileSyncPosix
fn fileSyncPosix (userdata : ?*anyopaque , file : File ) File .SyncError !void
File
Code
fn fileSyncPosix (userdata : ?*anyopaque , file : File ) File .SyncError !void {
const t : *Threaded = @ptrCast (@alignCast (userdata ));
_ = t ;
const syscall : Syscall = try .start ();
while (true ) {
switch (posix .errno (posix .system .fsync (file .handle ))) {
.SUCCESS => return syscall .finish (),
.INTR => {
try syscall .checkCancel ();
continue ;
},
else => |e | {
syscall .finish ();
switch (e ) {
.BADF => |err | return errnoBug (err ),
.INVAL => |err | return errnoBug (err ),
.ROFS => |err | return errnoBug (err ),
.IO => return error .InputOutput ,
.NOSPC => return error .NoSpaceLeft ,
.DQUOT => return error .DiskQuota ,
else => |err | return posix .unexpectedErrno (err ),
}
},
}
}
}