Skip to content

Commit 6606c44

Browse files
authored
Add documentation about starting file descriptors in Preview1. (#522)
* 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".
1 parent ddfe3d1 commit 6606c44

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

legacy/application-abi.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ Regardless of the kind, all modules accessing WASI APIs also export a table
5151
with the name `__indirect_function_table`. Function pointers in WASI API calls
5252
are relative to this table's index space.
5353

54+
When `_start` or `_initialize` is called, environments shall provide file
55+
descriptors with indices 0, 1, and 2 representing stream resources for
56+
standard input, standard output, and standard error. Environments may provide
57+
additional "preopen" file descriptors that can be inspected with
58+
`fd_prestat_get` and `fd_prestat_dir_name`. These resources may be closed at
59+
any time.
60+
5461
Environments shall not access exports named `__heap_base` or `__data_end`.
5562
Toolchains are encouraged to avoid providing these exports.
5663

0 commit comments

Comments
 (0)