@@ -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)
@@ -781,6 +784,14 @@ Word wasi_unstable_fd_close(Word /*fd*/) {
781
784
return 0 ;
782
785
}
783
786
787
+ // __wasi_errno_t __wasi_path_filestat_get(__wasi_fd_t fd,__wasi_lookupflags_t flags,const char
788
+ // *path,size_t path_len,__wasi_filestat_t *buf);
789
+
790
+ Word wasi_unstable_path_filestat_get (Word /* fd*/ , Word /* flags*/ , Word /* path*/ , Word /* path_len*/ ,
791
+ Word /* buf*/ ) {
792
+ return 58 ; // __WASI_ENOTSUP
793
+ }
794
+
784
795
// __wasi_errno_t __wasi_fd_fdstat_get(__wasi_fd_t fd, __wasi_fdstat_t *stat)
785
796
Word wasi_unstable_fd_fdstat_get (Word fd, Word statOut) {
786
797
// We will only support this interface on stdout and stderr
@@ -801,6 +812,13 @@ Word wasi_unstable_fd_fdstat_get(Word fd, Word statOut) {
801
812
return 0 ; // __WASI_ESUCCESS
802
813
}
803
814
815
+ // __wasi_errno_t __wasi_fd_fdstat_set_flags(__wasi_fd_t fd, __wasi_fdflags_t flags)
816
+ Word wasi_unstable_fd_fdstat_set_flags (Word /* fd*/ , Word /* flags*/ ) {
817
+ // Flags that can be specified: append, dsync, nonblock, rsync, and sync. Proxy-wasm only supports
818
+ // STDOUT and STDERR, but none of these flags have any effect in Proxy-Wasm.
819
+ return 52 ; // __WASI_ERRNO_ENOSYS
820
+ }
821
+
804
822
// __wasi_errno_t __wasi_environ_get(char **environ, char *environ_buf);
805
823
Word wasi_unstable_environ_get (Word environ_array_ptr, Word environ_buf) {
806
824
auto *context = contextOrEffectiveContext ();
@@ -904,6 +922,21 @@ Word wasi_unstable_random_get(Word result_buf_ptr, Word buf_len) {
904
922
return 0 ; // __WASI_ESUCCESS
905
923
}
906
924
925
+ // __wasi_errno_t __wasi_sched_yield()
926
+ Word wasi_unstable_sched_yield () {
927
+ // Per POSIX man pages, it is valid to return success if the calling thread is the only thread in
928
+ // the highest priority list. This is vacuously true for wasm without threads. There are no valid
929
+ // error cases defined.
930
+ return 0 ; // __WASI_ESUCCESS
931
+ }
932
+
933
+ // __wasi_errno_t __wasi_poll_oneoff(const __wasi_subscription_t *in, __wasi_event_t *out,
934
+ // __wasi_size_t nsubscriptions, __wasi_size_t *nevents)
935
+ Word wasi_unstable_poll_oneoff (Word /* in*/ , Word /* out*/ , Word /* nsubscriptions*/ ,
936
+ Word /* nevents_ptr*/ ) {
937
+ return 52 ; // __WASI_ERRNO_ENOSYS
938
+ }
939
+
907
940
// void __wasi_proc_exit(__wasi_exitcode_t rval);
908
941
void wasi_unstable_proc_exit (Word /* exit_code*/ ) {
909
942
auto *context = contextOrEffectiveContext ();
0 commit comments