Stream: wasi

Topic: valid file descriptors


view this post on Zulip Mohamed Abdelfatah (Jul 22 2022 at 16:03):

Is it allowed to pass file descriptors 0, 1 and 2 to fd_prestat_get ?

I tried it in wasmtime and it returns Bad file descriptor
while wasmer returns Ok() with a Prestat struct for the corresponding fd (i.e. stdin for fd = 0 , stdout for fd =1 , stderr for fd = 2).

which behavior is correct ?

for context: I am comparing different wasi implementations between engines, initially I am working on wasmer and wasmtime. I am also using this crate to use the wasi api

WebAssembly System Interface. Contribute to WebAssembly/WASI development by creating an account on GitHub.

view this post on Zulip Lann Martin (Jul 22 2022 at 16:53):

afaik "preopened" is only meaningful for directories currently

view this post on Zulip Lann Martin (Jul 22 2022 at 16:54):

Which is slightly confusing since other fds provided by the host are in some sense pre-opened...

view this post on Zulip Lann Martin (Jul 22 2022 at 16:55):

https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/witx/typenames.witx#L728-L734

WebAssembly System Interface. Contribute to WebAssembly/WASI development by creating an account on GitHub.

Last updated: Oct 23 2024 at 20:03 UTC