Skip to content
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

Add documentation about starting file descriptors in Preview1. #522

Merged

Conversation

sunfishcode
Copy link
Member

Add documentation mentioning stdin, stdout, and stderr file descriptors, and also preopen file descriptors, and mention that preopen file descriptors can be closed.

Allowing preopen file descriptors to be closed is a change from how Wasmtime historically worked, but I think it's more clear now that it's ok to let preopens be closed. We'll change Wasmtime accordingly.

This addresses WebAssembly/wasi-testsuite#50.

Add documentation mentioning stdin, stdout, and stderr file descriptors,
and also preopen file descriptors, and mention that preopen file
descriptors can be closed.

Allowing preopen file descriptors to be closed is a change from how
Wasmtime historically worked, but I think it's more clear now that
it's ok to let preopens be closed. We'll change Wasmtime accordingly.

This addresses WebAssembly/wasi-testsuite#50.
@@ -51,6 +51,13 @@ Regardless of the kind, all modules accessing WASI APIs also export a table
with the name `__indirect_function_table`. Function pointers in WASI API calls
are relative to this table's index space.

When `_start` or `_initialize` is called, environments shall provide file
descriptors with indices 0, 1, and 2 representing file-like resources for
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you mean by "file-like"?
the wording made me think regular files. but i guess it isn't what you meant here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point, "file-like" is ambiguous. I've now changed it to say "stream" instead.

@sunfishcode sunfishcode merged commit 6606c44 into WebAssembly:main Mar 6, 2023
@sunfishcode sunfishcode deleted the sunfishcode/preview1-close-preopens branch March 6, 2023 18:27
sunfishcode added a commit to sunfishcode/wasi-testsuite that referenced this pull request Mar 20, 2023
This updates the close_preopens test to the latest upstream version,
which implements WebAssembly/WASI#522. Preopens
may now be closed.
loganek pushed a commit to WebAssembly/wasi-testsuite that referenced this pull request Mar 21, 2023
This updates the close_preopens test to the latest upstream version,
which implements WebAssembly/WASI#522. Preopens
may now be closed.
yamt added a commit to yamt/toywasm that referenced this pull request Apr 17, 2023
yamt added a commit to yamt/toywasm that referenced this pull request Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants