-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
wasmtime-wasi: introduce WasiP1Ctx #8053
Conversation
Subscribe to Label Actioncc @peterhuene
This issue or pull request has been labeled: "wasi", "wasmtime:c-api"
Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. (Looks like one of those things that if it builds and passes CI, it's most likely OK.)
… closure and add a few missing bits of functionality for use in the c-api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
This PR should be backported to the release-19.0.0 branch |
… closure (bytecodealliance#8053) and add a few missing bits of functionality for use in the c-api
* wasmtime-wasi: introduce WasiP1Ctx, re-jigger p0 & p1 linkers to take closure (#8053) and add a few missing bits of functionality for use in the c-api * wasmtime c-api: warn that wasi_config_preopen_socket is deprecated in next release (#8064) this PR will be backported to the release-19.0.0 branch prior to the 19 release. * Add release notes --------- Co-authored-by: Pat Hickey <phickey@fastly.com>
This PR adds
wasmtime_wasi::WasiP1Ctx
, which is aWasiCtx
for just using WASI P1 (and P0).This simplifies user experience for users migrating from wasi-common's P1 support - it means they don't have to know about the
*View
traits or theWasiPreview1Adapter
, which are just implementation details to a P1 embedder.The p1/p0
add_to_linker_{a?}sync
functions now take a closure that is the lens for the T in Store, to be consistent with wasi-common and in general whatwasmtime::Linker
users expect.WasiCtxBuilder now has a convenient function
build_p1(&mut self) -> WasiP1Ctx
that can be used in the place ofbuild(&mut self) -> WasiCtx
for users targeting a P1 embedding.This PR also adds two trivial methods to WasiCtxBuilder to reflect ones that existed in wasi-common;s:
inherit_env
andinherit_args
.Finally, this PR adds
AsyncStdinStream
andAsyncStdoutStream
as wrappers onAsyncReadStream
andAsyncWriteStream
to provide implementations ofStdinStream
andStdoutStream
. (This could be separated into a totally different PR, but it doesnt seem worth the e-paperwork overhead to bother.) These provide parity with the wasi-common affordances for piping stdio to/from files, which happen to be used in the c-api.The top-level tests and examples that were using
wasi-common
are updated to usewasmtime-wasi::WasiP1Ctx
.