-
Notifications
You must be signed in to change notification settings - Fork 830
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement wasi::poll_oneoff on Windows #570
Comments
We're missing a few pieces of WASI now that we can implement and I'll be prioritizing that in the next couple of weeks, but there are a few pieces that aren't really defined yet. Sockets and poll_oneoff haven't been designed yet. Development of the pieces of WASI (by the WASI subgroup) hasn't been a priority yet because we're still defining the groundwork on which we can work independently on the various pieces. WASI is getting close to being ready to start development on these pieces though. I can't give you any kind of timeline, but we'll implement it as soon as it's defined (or during its definition so we can give feedback) |
I'm very new to WASI (and WASM for that matter) so excuse my ignorance :-) At this point, I'm trying to run a JS interpreter which uses select / poll for timers. I know sockets are not there yet, but I was under the impression that poll_oneoff was already part of WASI: https://github.com/WebAssembly/WASI/blob/b81f586ecdca184764e91587a18d59b1d85242c9/design/WASI-core.md#__wasi_poll_oneoff AFAIS the WASI C SDK does implement poll(2) using |
Oh, I see! Thanks for correcting me! I misread your post as "wasmtime doesn't implement it" and assumed this was something that hadn't been designed yet. Sure, then this will be on my list of things to add in the coming week or two! |
Okay! I'm actively working on this now, do you happen to have a Wasm binary I can use to test this? If not, don't worry about it, I'll make one. I won't be able to finish it this week, but it'll hopefully be finished early next week! |
There you go, cheers! |
Thanks! I got the repl working quite quickly by returning 0 bytes found/success. But I've been pretty stumped on how to implement this properly in a robust and cross-platform way. Especially given that our new public API means that files can be backed by arbitrary Rust code. So we'll need some async functions in our I'll have to learn more about ioctl/poll and Rust async to properly do this I think |
I might be talking out of my ass here, but anyway... :-) Maybe using |
@saghul Yeah, I think that might work, but we'll have to write a different version for Windows/NT and other operating systems. I think something like Tokio might be the solution we want. I also got the impression that I can't just use Thanks! I think there's probably a path toward getting a subset of this properly working quickly, just need to work on it some more |
@MarkMcCaskey Yes, that won't work on Windows. libc doesn't seem to wrap Tokio seems to big of a dependency IMHO, just to get level-triggered I/O. As for FTR: wasmtime seems to implement this in C and the wrapping it in Rust. I can't see how it can work on Windows though. At any rate, I applaud you treating Windows as a first class citizen :-) |
@saghul Thanks! That article was extremely useful! Hmm, it says OSX is even worse... that's concerning. I'll have to look into that too Yeah, we want to avoid platform specific code if we can -- so far our WASI implementation has been fully portable except for some assumptions with files earlier on and accessing clocks. Anyways, for now I ended up just implementing it for Unix using I think it's the best I can do right now, but I'll keep thinking about it. I'm noticing some weird behavior where returning that's a good point about |
Ah, true that! |
671: Add wasi::poll_oneoff for Unix r=MarkMcCaskey a=MarkMcCaskey Part of #570 Co-authored-by: Mark McCaskey <[email protected]> Co-authored-by: Mark McCaskey <[email protected]>
This is now implemented in |
Not quite:
Can you please reopen? |
Good catch! Thanks |
It now works :-). Closing the issue. |
@Hywan it only works in Linux, not in Windows yet. |
Is this issue solved? seems like mentioned PRs are merged. |
I checked, and no, it's not really fixed. |
A rewrite / refactor of WASI is planed for the 3.2, so Assigning this ticket to this milestone. |
This seems to be implemented already so I'm going to close the ticket. |
Motivation
It's part of the WASI API, but not yet implemented. Also, wasmtime does implement it ;-)
The text was updated successfully, but these errors were encountered: