feature. See also
. The project being documented here (as the example) is the Zig library itself.
Uring.writeSync
fn writeSync(sync: *CancelRegion.Sync, fd: fd_t, buffer: []const u8) File.Writer.Error!usize
File
Code
fn writeSync(sync: *CancelRegion.Sync, fd: fd_t, buffer: []const u8) File.Writer.Error!usize {
while (true) {
try sync.cancel_region.await(.nothing);
const rc = linux.write(fd, buffer.ptr, buffer.len);
switch (linux.errno(rc)) {
.SUCCESS => return @intCast(rc),
.INTR => {},
.INVAL => |err| return errnoBug(err),
.FAULT => |err| return errnoBug(err),
.AGAIN => return error.WouldBlock,
.BADF => return error.NotOpenForWriting,
.DESTADDRREQ => |err| return errnoBug(err),
.DQUOT => return error.DiskQuota,
.FBIG => return error.FileTooBig,
.IO => return error.InputOutput,
.NOSPC => return error.NoSpaceLeft,
.PERM => return error.PermissionDenied,
.PIPE => return error.BrokenPipe,
.CONNRESET => |err| return errnoBug(err),
.BUSY => return error.DeviceBusy,
else => |err| return unexpectedErrno(err),
}
}
}