fn readIntFd(fd: posix.fd_t) !ErrInt fd: posix.fd_t15712
15713
15714
15715
15716
15717
15718
15719
15720
15721
15722
15723
15724
15725
15726
15727
15728
15729
15730fn readIntFd(fd: posix.fd_t) !ErrInt {
var buffer: [8]u8 = undefined;
var i: usize = 0;
while (true) {
const rc = posix.system.read(fd, buffer[i..].ptr, buffer.len - i);
switch (posix.errno(rc)) {
.SUCCESS => {
const n: usize = @intCast(rc);
if (n == 0) break;
i += n;
continue;
},
.INTR => continue,
else => |err| return posix.unexpectedErrno(err),
}
}
if (buffer.len - i != 0) return error.EndOfStream;
return @intCast(std.mem.readInt(u64, &buffer, .little));
}