@@ -671,6 +671,9 @@ Word grpc_send(Word token, Word message_ptr, Word message_size, Word end_stream)
671
671
return context->grpcSend (token, message.value (), end_stream != 0U );
672
672
}
673
673
674
+ // WASIp1 typings in comments sourced from
675
+ // https://github.com/WebAssembly/wasi-libc/blob/446cb3f1aa21f9b1a1eab372f82d65d19003e924/libc-bottom-half/headers/public/wasi/api.h
676
+
674
677
// __wasi_errno_t path_open(__wasi_fd_t fd, __wasi_lookupflags_t dirflags, const char *path,
675
678
// size_t path_len, __wasi_oflags_t oflags, __wasi_rights_t fs_rights_base, __wasi_rights_t
676
679
// fs_rights_inheriting, __wasi_fdflags_t fdflags, __wasi_fd_t *retptr0)
@@ -801,6 +804,13 @@ Word wasi_unstable_fd_fdstat_get(Word fd, Word statOut) {
801
804
return 0 ; // __WASI_ESUCCESS
802
805
}
803
806
807
+ // __wasi_errno_t __wasi_fd_fdstat_set_flags(__wasi_fd_t fd, __wasi_fdflags_t flags)
808
+ Word wasi_unstable_fd_fdstat_set_flags (Word /* fd*/ , Word /* flags*/ ) {
809
+ // Flags that can be specified: append, dsync, nonblock, rsync, and sync. Proxy-wasm only supports
810
+ // STDOUT and STDERR, but none of these flags have any effect in Proxy-Wasm.
811
+ return 52 ; // __WASI_ERRNO_ENOSYS
812
+ }
813
+
804
814
// __wasi_errno_t __wasi_environ_get(char **environ, char *environ_buf);
805
815
Word wasi_unstable_environ_get (Word environ_array_ptr, Word environ_buf) {
806
816
auto *context = contextOrEffectiveContext ();
@@ -904,6 +914,21 @@ Word wasi_unstable_random_get(Word result_buf_ptr, Word buf_len) {
904
914
return 0 ; // __WASI_ESUCCESS
905
915
}
906
916
917
+ // __wasi_errno_t __wasi_sched_yield()
918
+ Word wasi_unstable_sched_yield () {
919
+ // Per POSIX man pages, it is valid to return success if the calling thread is the only thread in
920
+ // the highest priority list. This is vacuously true for wasm without threads. There are no valid
921
+ // error cases defined.
922
+ return 0 ; // __WASI_ESUCCESS
923
+ }
924
+
925
+ // __wasi_errno_t __wasi_poll_oneoff(const __wasi_subscription_t *in, __wasi_event_t *out,
926
+ // __wasi_size_t nsubscriptions, __wasi_size_t *nevents)
927
+ Word wasi_unstable_poll_oneoff (Word /* in*/ , Word /* out*/ , Word /* nsubscriptions*/ ,
928
+ Word /* nevents_ptr*/ ) {
929
+ return 52 ; // __WASI_ERRNO_ENOSYS
930
+ }
931
+
907
932
// void __wasi_proc_exit(__wasi_exitcode_t rval);
908
933
void wasi_unstable_proc_exit (Word /* exit_code*/ ) {
909
934
auto *context = contextOrEffectiveContext ();
0 commit comments