@@ -646,6 +646,9 @@ Word grpc_send(Word token, Word message_ptr, Word message_size, Word end_stream)
646
646
return context->grpcSend (token, message.value (), end_stream != 0U );
647
647
}
648
648
649
+ // WASIp1 typings in comments sourced from
650
+ // https://github.com/WebAssembly/wasi-libc/blob/446cb3f1aa21f9b1a1eab372f82d65d19003e924/libc-bottom-half/headers/public/wasi/api.h
651
+
649
652
// __wasi_errno_t path_open(__wasi_fd_t fd, __wasi_lookupflags_t dirflags, const char *path,
650
653
// size_t path_len, __wasi_oflags_t oflags, __wasi_rights_t fs_rights_base, __wasi_rights_t
651
654
// fs_rights_inheriting, __wasi_fdflags_t fdflags, __wasi_fd_t *retptr0)
@@ -776,6 +779,13 @@ Word wasi_unstable_fd_fdstat_get(Word fd, Word statOut) {
776
779
return 0 ; // __WASI_ESUCCESS
777
780
}
778
781
782
+ // __wasi_errno_t __wasi_fd_fdstat_set_flags(__wasi_fd_t fd, __wasi_fdflags_t flags)
783
+ Word wasi_unstable_fd_fdstat_set_flags (Word /* fd*/ , Word /* flags*/ ) {
784
+ // Flags that can be specified: append, dsync, nonblock, rsync, and sync. Proxy-wasm only supports
785
+ // STDOUT and STDERR, but none of these flags have any effect in Proxy-Wasm.
786
+ return 52 ; // __WASI_ERRNO_ENOSYS
787
+ }
788
+
779
789
// __wasi_errno_t __wasi_environ_get(char **environ, char *environ_buf);
780
790
Word wasi_unstable_environ_get (Word environ_array_ptr, Word environ_buf) {
781
791
auto *context = contextOrEffectiveContext ();
@@ -879,6 +889,21 @@ Word wasi_unstable_random_get(Word result_buf_ptr, Word buf_len) {
879
889
return 0 ; // __WASI_ESUCCESS
880
890
}
881
891
892
+ // __wasi_errno_t __wasi_sched_yield()
893
+ Word wasi_unstable_sched_yield () {
894
+ // Per POSIX man pages, it is valid to return success if the calling thread is the only thread in
895
+ // the highest priority list. This is vacuously true for wasm without threads. There are no valid
896
+ // error cases defined.
897
+ return 0 ; // __WASI_ESUCCESS
898
+ }
899
+
900
+ // __wasi_errno_t __wasi_poll_oneoff(const __wasi_subscription_t *in, __wasi_event_t *out,
901
+ // __wasi_size_t nsubscriptions, __wasi_size_t *nevents)
902
+ Word wasi_unstable_poll_oneoff (Word /* in*/ , Word /* out*/ , Word /* nsubscriptions*/ ,
903
+ Word /* nevents_ptr*/ ) {
904
+ return 52 ; // __WASI_ERRNO_ENOSYS
905
+ }
906
+
882
907
// void __wasi_proc_exit(__wasi_exitcode_t rval);
883
908
void wasi_unstable_proc_exit (Word /* exit_code*/ ) {
884
909
auto *context = contextOrEffectiveContext ();
0 commit comments