Skip to content

Commit cde187a

Browse files
committed
fix poll oneoff return error
1 parent 3f37970 commit cde187a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/exports.cc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -938,8 +938,15 @@ Word wasi_unstable_sched_yield() {
938938
// __wasi_errno_t __wasi_poll_oneoff(const __wasi_subscription_t *in, __wasi_event_t *out,
939939
// __wasi_size_t nsubscriptions, __wasi_size_t *nevents)
940940
Word wasi_unstable_poll_oneoff(Word /*in*/, Word /*out*/, Word /*nsubscriptions*/,
941-
Word /*nevents_ptr*/) {
942-
return 52; // __WASI_ERRNO_ENOSYS
941+
Word nevents_ptr) {
942+
auto *context = contextOrEffectiveContext();
943+
944+
// Since we are not performing event polling, directly set nevents to 0
945+
if (!context->wasmVm()->setWord(nevents_ptr, Word(0))) {
946+
return 21; // __WASI_EFAULT - If there is a failure setting memory
947+
}
948+
949+
return 0; // __WASI_ESUCCESS
943950
}
944951

945952
// void __wasi_proc_exit(__wasi_exitcode_t rval);

0 commit comments

Comments
 (0)