-
Notifications
You must be signed in to change notification settings - Fork 12
WASI
WASI is a common system interface for WebAssembly. Many languages and frameworks targeting Wasm take advantage of or rely on WASI. To support these, Godot Wasm supports a small subset of common WASI import functions by default. This enables easier use of WASI-reliant Wasm modules without reimplementing common functionality.
Information regarding specific WASI import functions can be found in the WASI specification.
wasi_snapshot_preview1.fd_write
wasi_snapshot_preview1.proc_exit
wasi_snapshot_preview1.clock_time_get
wasi_snapshot_preview1.args_sizes_get
wasi_snapshot_preview1.args_get
-
wasi_snapshot_preview1.environ_sizes_get
(stubbed out) -
wasi_snapshot_preview1.environ_get
(stubbed out) wasi_snapshot_preview1.random_get
Note that some functions are stubbed out to ensure a safer Wasm sandbox while maintaining compatibility. For example, Wasm modules are intentionally unable to access environment variables using wasi_snapshot_preview1.environ_sizes_get
which simply reports no accessible environment variables.
The above WASI import functions are enabled by default but can be configured using the Wasm.permissions
dictionary. The following permissions can be set to toggle functionality of default WASI functions.
print
time
random
args
exit
Permissions can be queried using wasm.has_permission(PERMISSION)
(replacing PERMISSION
with the relevant permission string e.g. print
) and set using an update dictionary wasm.permission = { 'print': false }
.
Note that an error is reported if a module attempts to access a WASI import function whose permission is disabled.