Wasip3: File handing implementation#757
Merged
alexcrichton merged 1 commit intoWebAssembly:mainfrom Mar 3, 2026
Merged
Conversation
dicej
approved these changes
Mar 3, 2026
libc-bottom-half/sources/file.c
Outdated
| } | ||
| if (file->write_subtask != 0) { | ||
| // TODO: this should use `wasip3_subtask_cancel` but right now that's buggy | ||
| // in Wasmtime. For now assume closign the stream above is enough to have |
Collaborator
There was a problem hiding this comment.
Suggested change
| // in Wasmtime. For now assume closign the stream above is enough to have | |
| // in Wasmtime. For now assume closing the stream above is enough to have |
Collaborator
There was a problem hiding this comment.
Also, is there an issue URL we can reference here?
Collaborator
Author
There was a problem hiding this comment.
Good point yeah, this was fixed in bytecodealliance/wasmtime#12640 so I left a note here that 43.0.0 will be sufficient to change this.
This is an initial implementation of some basic file-handling functions such as reading, writing, opening directories, iterating them, etc. A number of previously failing tests are now passing and the `wasip2_file.c` implementation is now merged with WASIp3 with `file.c`. Bindings generation is also updated to flag some specific functions as being lowered synchronously as libc always blocks on the result. Co-authored-by: Christof Petig <christof.petig@arcor.de>
0ef1e9c to
5c58556
Compare
Collaborator
Author
|
The new stdio test I wrote is running afoul of bytecodealliance/wasmtime#12711, so I'm going to remove the test from this PR and defer it to once Wasmtime 43 is released. |
alexcrichton
added a commit
that referenced
this pull request
Mar 3, 2026
This is a further extension of #757 to implement much more functionality in wasi-libc related to filesystems for the `wasm32-wasip3` target. This largely reuses the `wasm32-wasip2` implementations of things by generated bindings in non-async mode. The end result of this is a whole slew of tests are now passing on the p3 target.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an initial implementation of some basic file-handling functions such as reading, writing, opening directories, iterating them, etc. A number of previously failing tests are now passing and the
wasip2_file.cimplementation is now merged with WASIp3 withfile.c. Bindings generation is also updated to flag some specific functions as being lowered synchronously as libc always blocks on the result.Note that much of this PR is primarily authored by @cpetig. I've rebased, squashed, and applied my own review comments from #720 to this. Notably some small edge cases here and there are handled and like with other files
wasip{2,3}_file.chas now simply becomefile.cwith both versions living in the same file.