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 › Uring › fileSync Private Function fileSync Doc Source Private Function std.Io.Uring.fileSync
fn fileSync (userdata : ?*anyopaque , file : File ) File .SyncError !void Params userdata : ?*anyopaque file : File File Io/Uring.zig: 3777
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812 fn fileSync (userdata : ?*anyopaque , file : File ) File .SyncError !void {
const ev : *Evented = @ptrCast (@alignCast (userdata ));
var cancel_region : CancelRegion = .init ();
defer cancel_region .deinit ();
while (true ) {
const thread = try cancel_region .awaitIoUring ();
thread .enqueue ().* = .{
.opcode = .FSYNC ,
.flags = 0 ,
.ioprio = 0 ,
.fd = file .handle ,
.off = 0 ,
.addr = 0 ,
.len = 0 ,
.rw_flags = 0 ,
.user_data = @intFromPtr (cancel_region .fiber ),
.buf_index = 0 ,
.personality = 0 ,
.splice_fd_in = 0 ,
.addr3 = 0 ,
.resv = 0 ,
};
ev .yield (null , .nothing );
switch (cancel_region .errno ()) {
.SUCCESS => return ,
.INTR , .CANCELED => {},
.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 unexpectedErrno (err ),
}
}
}