Skip to content

Commit

Permalink
Add documentation about starting file descriptors in Preview1. (#522)
Browse files Browse the repository at this point in the history
* Add documentation about starting file descriptors in Preview1.

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.

* Say "stream" instead of "file-like".
  • Loading branch information
sunfishcode committed Mar 6, 2023
1 parent ddfe3d1 commit 6606c44
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions legacy/application-abi.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 stream resources for
standard input, standard output, and standard error. Environments may provide
additional "preopen" file descriptors that can be inspected with
`fd_prestat_get` and `fd_prestat_dir_name`. These resources may be closed at
any time.

Environments shall not access exports named `__heap_base` or `__data_end`.
Toolchains are encouraged to avoid providing these exports.

Expand Down

0 comments on commit 6606c44

Please sign in to comment.