Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions cmd/workers-assets-gen/assets/wasm_exec_tinygo.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,11 @@
}

const timeOrigin = Date.now() - performance.now();
const wasi_EBADF = 8;
const wasi_ENOSYS = 52;
this.importObject = {
wasi_snapshot_preview1: {
// https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md#fd_write
// https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md
fd_write: function(fd, iovs_ptr, iovs_len, nwritten_ptr) {
let nwritten = 0;
if (fd == 1) {
Expand Down Expand Up @@ -276,9 +278,13 @@
mem().setUint32(nwritten_ptr, nwritten, true);
return 0;
},
fd_close: () => 0, // dummy
fd_fdstat_get: () => 0, // dummy
fd_seek: () => 0, // dummy
fd_read: () => wasi_ENOSYS,
fd_close: () => wasi_ENOSYS,
fd_fdstat_get: () => wasi_ENOSYS,
fd_prestat_get: () => wasi_EBADF, // wasi-libc relies on this errno value
fd_prestat_dir_name: () => wasi_ENOSYS,
fd_seek: () => wasi_ENOSYS,
path_open: () => wasi_ENOSYS,
proc_exit: (code) => {
this.exited = true;
this.exitCode = code;
Expand Down
Loading