Closed Nyaa97 closed 3 weeks ago
Poll events should be bit map But I don't see myself using a single Pool for several events
pub const Poll = struct {
pub const Events = packed struct(u32) {
in: bool = false,
out: bool = false,
pri: bool = false,
_: u29 = 0,
};
pub const Error = std.posix.PollError || SharedError;
fd: std.posix.fd_t,
events: Events = .{ .in = true },
out_id: ?*Id = null,
out_error: ?*Error = null,
link: Link = .unlinked,
userdata: usize = 0,
};
aio.Single(aio.Poll{ .fd = fd, .events = .{ .out = true } });
In addition, I don't like the implementation of Readiness.mode which makes it difficult to simply check mode
pub const Readiness = struct {
fd: std.posix.fd_t = invalid_fd,
mode: packed struct(i16) {
in: bool = false,
out: bool = false,
pri: bool = false,
kludge: bool = false,
_: u12 = 0,
},
};
I made a draft I am not sure how it should be 🤔
The readiness originally was not meant to implement poll. Your changes make sense. The kludge
field probably can live outside of the packed struct as bool, as it is not a poll thing. Then I guess Events could be intCast'd to mode.
I'd also be grateful if you can add more tests.
Poll struct must not panic (comptime), or else building on Windows will be impossible
Thank you
Add of the poll op described at https://unixism.net/loti/ref-iouring/io_uring_enter.html