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

Use WASI builder directly in C API #8572

Merged
merged 2 commits into from
May 7, 2024

Conversation

alexcrichton
Copy link
Member

This commit updates the C API to use the WasiCtxBuilder directly within wasi_config_t instead of buffering up the options separately. This keeps the behavior of the Rust-based API more similar to the C API and should also help resolve #8552 due to errors being returned more eagerly in the builder-based API.

This additionally makes some minor modifications to the C APIs here as appropriate.

Close #8552

This commit updates the C API to use the `WasiCtxBuilder` directly
within `wasi_config_t` instead of buffering up the options separately.
This keeps the behavior of the Rust-based API more similar to the C API
and should also help resolve bytecodealliance#8552 due to errors being returned more
eagerly in the builder-based API.

This additionally makes some minor modifications to the C APIs here as
appropriate.

Close bytecodealliance#8552
@alexcrichton alexcrichton requested a review from a team as a code owner May 7, 2024 14:58
@alexcrichton alexcrichton requested review from elliottt and removed request for a team May 7, 2024 14:58
@github-actions github-actions bot added the wasmtime:c-api Issues pertaining to the C API. label May 7, 2024
@whitequark
Copy link
Contributor

@alexcrichton Since I've been looking at this PR: do you think you could expose memory stdio in wasmtime-py?

@alexcrichton
Copy link
Member Author

Sure yeah! Should be simple enough, the functions just didn't exist when I first wrote wasmtime-py

Copy link
Contributor

@pchickey pchickey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice simplification. One minor bug

crates/c-api/src/wasi.rs Outdated Show resolved Hide resolved
@alexcrichton alexcrichton enabled auto-merge May 7, 2024 20:27
@alexcrichton alexcrichton added this pull request to the merge queue May 7, 2024
Merged via the queue into bytecodealliance:main with commit e55fa3c May 7, 2024
24 checks passed
@alexcrichton alexcrichton deleted the update-wasi-c-api branch May 7, 2024 21:06
alexcrichton added a commit to alexcrichton/wasmtime that referenced this pull request May 7, 2024
* Use WASI builder directly in C API

This commit updates the C API to use the `WasiCtxBuilder` directly
within `wasi_config_t` instead of buffering up the options separately.
This keeps the behavior of the Rust-based API more similar to the C API
and should also help resolve bytecodealliance#8552 due to errors being returned more
eagerly in the builder-based API.

This additionally makes some minor modifications to the C APIs here as
appropriate.

Close bytecodealliance#8552

* Review comments
alexcrichton added a commit that referenced this pull request May 7, 2024
* Use WASI builder directly in C API

This commit updates the C API to use the `WasiCtxBuilder` directly
within `wasi_config_t` instead of buffering up the options separately.
This keeps the behavior of the Rust-based API more similar to the C API
and should also help resolve #8552 due to errors being returned more
eagerly in the builder-based API.

This additionally makes some minor modifications to the C APIs here as
appropriate.

Close #8552

* Review comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasmtime:c-api Issues pertaining to the C API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Since Wasmtime 20, preopens of non-existent directories fail eagerly rather than on first access
3 participants