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

new: Add WasiCtx #190

Closed
wants to merge 2 commits into from
Closed

new: Add WasiCtx #190

wants to merge 2 commits into from

Conversation

gaukas
Copy link

@gaukas gaukas commented Sep 11, 2023

Reflecting C-API changes made in bytecodealliance/wasmtime#7001 by adding incomplete implementation for WasiCtx:

  • func (store *Store) GetWasiCtx() *WasiCtx
  • func (c *WasiConfig) PreopenTCPSocket(innerFD uint32, hostPort string) error*: not a part of WasiCtx, but adding it since it was already there in C-API.
  • type WasiFileAccessMode uint32*
  • type WasiCtx struct
    • (*WasiCtx).InsertFile(guestFD uint32, file *os.File, accessMode WasiFileAccessMode)
    • (*WasiCtx).PushFile(file *os.File, accessMode WasiFileAccessMode) (uint32, error)

*: Credit goes to @jmwample.


This pull request depends on the pull request editing the C-API, and has been discussed here: #187

Reflecting C-API changes made in bytecodealliance/wasmtime#7001 by adding incomplete implementation for `WasiCtx`:
- `func (store *Store) GetWasiCtx() *WasiCtx`
- `func (c *WasiConfig) PreopenTCPSocket(innerFD uint32, hostPort string) error`*: not a part of `WasiCtx`, but adding it since it was already there in C-API.
- `type WasiFileAccessMode uint32`*
- `type WasiCtx struct`
  - `(*WasiCtx).InsertFile(guestFD uint32, file *os.File, accessMode WasiFileAccessMode)`
  - `(*WasiCtx).PushFile(file *os.File, accessMode WasiFileAccessMode) (uint32, error)`

*: Credit goes to @jmwample.

---------

Co-authored-by: jmwample <[email protected]>
Redesign `WasiCtx` to wrap a *Store.
Revise the member functions to call `wasmtime_context_*` functions from C-API.
@gaukas gaukas closed this Sep 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant