Skip to content
This repository has been archived by the owner on Dec 16, 2020. It is now read-only.

Support fd_read and fd_fdstat_get in WASI interface #425

Closed
gbrail opened this issue Feb 24, 2020 · 0 comments · Fixed by #431
Closed

Support fd_read and fd_fdstat_get in WASI interface #425

gbrail opened this issue Feb 24, 2020 · 0 comments · Fixed by #431

Comments

@gbrail
Copy link
Contributor

gbrail commented Feb 24, 2020

For some code I am generating using C++ and Emscripten, it is very hard to prevent emscripten from adding imports of the "fd_read" and "fd_fdstat_get" functions. I would like to add them to the WASI implementation in Envoy.

I already have a PR and these functions work:

fd_read always returns "EBADF"
fd_fdstat_get returns "EBADF" for anything other than fds 1 and 2 -- since we already allow code to write to those fds using fd_write, the implementation returns a reasonable response for those.

Before I submit a PR, I'd like to know what a reasonable testing strategy is. I'd be willing to attempt a stand-alone unit test for the WASI support in Envoy. Would that be helpful?

gbrail added a commit to gbrail/envoy-wasm that referenced this issue Feb 25, 2020
fd_read: Always returns EBADF
fd_fdstat_get: Returns a reasonable response for fds 0 and 1,
  and EBADF otherwise.

Add a "WASI" test configuration to the existing tests that checks
for proper implementation of these by testing "fprintf,"
"fread," and "isatty".

Fixes envoyproxy#425

Signed-off-by: Gregory Brail <gregbrail@google.com>
PiotrSikora pushed a commit that referenced this issue Mar 3, 2020
fd_read: Always returns ENOSYS
fd_fdstat_get: Returns a reasonable response for fds 0 and 1,
  and EBADF otherwise.

Add a "WASI" test configuration to the existing tests that checks
for proper implementation of these by testing "fprintf,"
"fread," and "isatty".

Fixes #425

Signed-off-by: Gregory Brail <gregbrail@google.com>
PiotrSikora pushed a commit to PiotrSikora/envoy that referenced this issue Mar 3, 2020
fd_read: Always returns ENOSYS
fd_fdstat_get: Returns a reasonable response for fds 0 and 1,
  and EBADF otherwise.

Add a "WASI" test configuration to the existing tests that checks
for proper implementation of these by testing "fprintf,"
"fread," and "isatty".

Fixes envoyproxy/envoy-wasm#425

Signed-off-by: Gregory Brail <gregbrail@google.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant