PollDescription :: struct {
fd: wasi.FileDescriptor;
- input: core.io.PollEvent;
- out: core.io.PollEvent;
+ in_events: core.io.PollEvent;
+ out_events: core.io.PollEvent;
}
__poll :: (fds: [] PollDescription, timeout: i32) -> void {
subs := core.alloc.array_from_stack(wasi.Subscription, count);
for i in fds.count {
subs[i].userdata = ~~ i;
- subs[i].u.tag = switch fds[i].input {
+ subs[i].u.tag = switch fds[i].in_events {
case .None => .FDRead;
case .Read => .FDRead;
case .Write => .FDWrite;
if ev.type !=.Clock {
if ev.fd_readwrite.nbytes > 0 {
i := cast(i32) ev.userdata;
- fds[i].out = fds[i].input;
+ fds[i].out_events = fds[i].in_events;
}
if ev.fd_readwrite.flags & .ReadWriteHangUp {
i := cast(i32) ev.userdata;
- fds[i].out = .Closed;
+ fds[i].out_events = .Closed;
}
}
}
poll = (use fs: &os.File, ev: io.PollEvent, timeout: i32) -> (io.Error, bool) {
p: [1] PollDescription = .[.{
fd = data.fd,
- input = ev,
+ in_events = ev,
}];
runtime.platform.__poll(p, timeout);
- return .None, p[0].out == ev;
+ return .None, p[0].out_events == ev;
}
}