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 adapter_{open|close}_badfd exports to Preview 1 adapter #7663

Merged
merged 2 commits into from
Dec 9, 2023

Conversation

dicej
Copy link
Contributor

@dicej dicej commented Dec 8, 2023

This is to be used by wasi-libc to reserve file descriptors for its own use (e.g. for sockets), ensuring that any attempt to pass them directly to Preview 1 functions will consistently return an error.

See WebAssembly/wasi-libc#447 for further details.

This is to be used by `wasi-libc` to reserve file descriptors for its own use
(e.g. for sockets), ensuring that any attempt to pass them directly to Preview 1
functions will consistently return an error.

See WebAssembly/wasi-libc#447 for further details.

Signed-off-by: Joel Dice <[email protected]>
@dicej dicej requested a review from a team as a code owner December 8, 2023 17:51
@dicej dicej requested review from pchickey and removed request for a team December 8, 2023 17:51
@alexcrichton
Copy link
Member

Could you add a test for this as well to showcase it working within a component? (e.g. crates/test-programs/src/bin/preview2_*.rs)

@github-actions github-actions bot added the wasi Issues pertaining to WASI label Dec 8, 2023
@dicej dicej added this pull request to the merge queue Dec 8, 2023
Merged via the queue into bytecodealliance:main with commit 4f2d634 Dec 9, 2023
19 checks passed
@dicej dicej deleted the badfd branch December 9, 2023 00:00
dicej added a commit to dicej/wasmtime that referenced this pull request Dec 12, 2023
…dealliance#7663)

* add `adapter_{open|close}_badfd` exports to Preview 1 adapter

This is to be used by `wasi-libc` to reserve file descriptors for its own use
(e.g. for sockets), ensuring that any attempt to pass them directly to Preview 1
functions will consistently return an error.

See WebAssembly/wasi-libc#447 for further details.

Signed-off-by: Joel Dice <[email protected]>

* add `preview2_adapter_badfd` test

Signed-off-by: Joel Dice <[email protected]>

---------

Signed-off-by: Joel Dice <[email protected]>
alexcrichton added a commit that referenced this pull request Dec 12, 2023
* add `adapter_{open|close}_badfd` exports to Preview 1 adapter (#7663)

* add `adapter_{open|close}_badfd` exports to Preview 1 adapter

This is to be used by `wasi-libc` to reserve file descriptors for its own use
(e.g. for sockets), ensuring that any attempt to pass them directly to Preview 1
functions will consistently return an error.

See WebAssembly/wasi-libc#447 for further details.

Signed-off-by: Joel Dice <[email protected]>

* add `preview2_adapter_badfd` test

Signed-off-by: Joel Dice <[email protected]>

---------

Signed-off-by: Joel Dice <[email protected]>

* Update `*_badfd` methods in the adapter to return an errno (#7672)

Makes them a bit more consistent with the rest of the WASI functions as
opposed to returning a boolean.

---------

Signed-off-by: Joel Dice <[email protected]>
Co-authored-by: Alex Crichton <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasi Issues pertaining to WASI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants