bytecodealliance / bytecodealliance/wasmtime
`fd_fdstat_set_flags` requires mutable access to the file descriptor table
- Dominant language
- Rust
- Stars
- 18.6k
- Forks
- 1.8k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 121
Description
In https://github.com/bytecodealliance/wasmtime/pull/5326, we discussed [extensively](https://github.com/bytecodealliance/wasmtime/pull/5326#discussion_r1033699107) how to resolve the build errors related to `fd_fdstat_set_flags`, a `wasi-common` function. When attempting to apply locking to `wasi-common` to enable multi-threaded access, this function was the sole remaining issue preventing the implementation of `WasiSnapshotPreview1` from using `&self` (what we wanted to switch to) instead of the current `&mut self`. If `fd_fdstat_set_flags` could take `&self` instead, this would result in a variety of benefits:
- there would be no need to wrap `WasiCtx` (and friends) in an inner structure containing an `Arc`; the `Arc` could be applied to the top-level `Host` structure instead
- all of `WasiSnapshotPreview1` could be implemented in terms of `&self` instead of `&mut self`
- several supporting `derive(Clone)` and mutating functions could go away
At some point I had heard of discussions to modify this API; if and when that happens, the above improvements could be made.
Contributor guide
Assessment
This issue has not been assessed yet.