feature. See also
. The project being documented here (as the example) is the Zig library itself.
Uring.lseek
fn lseek(
ev: *Evented,
sync: *CancelRegion.Sync,
fd: fd_t,
offset: u64,
whence: u32,
) File.SeekError!void
File
Code
fn lseek(
ev: *Evented,
sync: *CancelRegion.Sync,
fd: fd_t,
offset: u64,
whence: u32,
) File.SeekError!void {
_ = ev;
while (true) {
try sync.cancel_region.await(.nothing);
var result: u64 = undefined;
switch (linux.errno(switch (@sizeOf(usize)) {
else => comptime unreachable,
4 => linux.llseek(fd, offset, &result, whence),
8 => linux.lseek(fd, @bitCast(offset), whence),
})) {
.SUCCESS => return,
.INTR => {},
.BADF => |err| return errnoBug(err),
.INVAL => return error.Unseekable,
.OVERFLOW => return error.Unseekable,
.SPIPE => return error.Unseekable,
.NXIO => return error.Unseekable,
else => |err| return unexpectedErrno(err),
}
}
}