mirror of
				https://github.com/bytecodealliance/wasm-micro-runtime.git
				synced 2025-10-30 21:02:27 +00:00 
			
		
		
		
	Implement async termination of blocking thread (#2516)
Send a signal whose handler is no-op to a blocking thread to wake up the blocking syscall with either EINTR equivalent or partial success. Unlike the approach taken in the `dev/interrupt_block_insn` branch (that is, signal + longjmp similarly to `OS_ENABLE_HW_BOUND_CHECK`), this PR does not use longjmp because: * longjmp from signal handler doesn't work on nuttx refer to https://github.com/apache/nuttx/issues/10326 * the singal+longjmp approach may be too difficult for average programmers who might implement host functions to deal with See also https://github.com/bytecodealliance/wasm-micro-runtime/issues/1910
This commit is contained in:
		
							parent
							
								
									d436e846ab
								
							
						
					
					
						commit
						444b159963
					
				|  | @ -273,6 +273,13 @@ else () | ||||||
|     add_definitions (-DWASM_DISABLE_STACK_HW_BOUND_CHECK=0) |     add_definitions (-DWASM_DISABLE_STACK_HW_BOUND_CHECK=0) | ||||||
|   endif () |   endif () | ||||||
| endif () | endif () | ||||||
|  | if (WAMR_DISABLE_WAKEUP_BLOCKING_OP EQUAL 1) | ||||||
|  |   add_definitions (-DWASM_DISABLE_WAKEUP_BLOCKING_OP=1) | ||||||
|  |   message ("     Wakeup of blocking operations disabled") | ||||||
|  | else () | ||||||
|  |   add_definitions (-DWASM_DISABLE_WAKEUP_BLOCKING_OP=0) | ||||||
|  |   message ("     Wakeup of blocking operations enabled") | ||||||
|  | endif () | ||||||
| if (WAMR_BUILD_SIMD EQUAL 1) | if (WAMR_BUILD_SIMD EQUAL 1) | ||||||
|   if (NOT WAMR_BUILD_TARGET MATCHES "RISCV64.*") |   if (NOT WAMR_BUILD_TARGET MATCHES "RISCV64.*") | ||||||
|     add_definitions (-DWASM_ENABLE_SIMD=1) |     add_definitions (-DWASM_ENABLE_SIMD=1) | ||||||
|  |  | ||||||
							
								
								
									
										92
									
								
								core/iwasm/common/wasm_blocking_op.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										92
									
								
								core/iwasm/common/wasm_blocking_op.c
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,92 @@ | ||||||
|  | /*
 | ||||||
|  |  * Copyright (C) 2023 Midokura Japan KK.  All rights reserved. | ||||||
|  |  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #include "wasm_runtime_common.h" | ||||||
|  | 
 | ||||||
|  | #include "bh_platform.h" | ||||||
|  | #include "bh_common.h" | ||||||
|  | #include "bh_assert.h" | ||||||
|  | 
 | ||||||
|  | #if WASM_ENABLE_THREAD_MGR != 0 && defined(OS_ENABLE_WAKEUP_BLOCKING_OP) | ||||||
|  | 
 | ||||||
|  | #define LOCK(env) WASM_SUSPEND_FLAGS_LOCK((env)->wait_lock) | ||||||
|  | #define UNLOCK(env) WASM_SUSPEND_FLAGS_UNLOCK((env)->wait_lock) | ||||||
|  | 
 | ||||||
|  | #define ISSET(env, bit)                                                       \ | ||||||
|  |     ((WASM_SUSPEND_FLAGS_GET((env)->suspend_flags) & WASM_SUSPEND_FLAG_##bit) \ | ||||||
|  |      != 0) | ||||||
|  | #define SET(env, bit) \ | ||||||
|  |     WASM_SUSPEND_FLAGS_FETCH_OR((env)->suspend_flags, WASM_SUSPEND_FLAG_##bit) | ||||||
|  | #define CLR(env, bit) \ | ||||||
|  |     WASM_SUSPEND_FLAGS_FETCH_AND((env)->suspend_flags, ~WASM_SUSPEND_FLAG_##bit) | ||||||
|  | 
 | ||||||
|  | bool | ||||||
|  | wasm_runtime_begin_blocking_op(wasm_exec_env_t env) | ||||||
|  | { | ||||||
|  |     LOCK(env); | ||||||
|  |     bh_assert(!ISSET(env, BLOCKING)); | ||||||
|  |     SET(env, BLOCKING); | ||||||
|  |     if (ISSET(env, TERMINATE)) { | ||||||
|  |         CLR(env, BLOCKING); | ||||||
|  |         UNLOCK(env); | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  |     UNLOCK(env); | ||||||
|  |     os_begin_blocking_op(); | ||||||
|  |     return true; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void | ||||||
|  | wasm_runtime_end_blocking_op(wasm_exec_env_t env) | ||||||
|  | { | ||||||
|  |     int saved_errno = errno; | ||||||
|  |     LOCK(env); | ||||||
|  |     bh_assert(ISSET(env, BLOCKING)); | ||||||
|  |     CLR(env, BLOCKING); | ||||||
|  |     UNLOCK(env); | ||||||
|  |     os_end_blocking_op(); | ||||||
|  |     errno = saved_errno; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void | ||||||
|  | wasm_runtime_interrupt_blocking_op(wasm_exec_env_t env) | ||||||
|  | { | ||||||
|  |     /*
 | ||||||
|  |      * ISSET(BLOCKING) here means that the target thread | ||||||
|  |      * is in somewhere between wasm_begin_blocking_op and | ||||||
|  |      * wasm_end_blocking_op. | ||||||
|  |      * keep waking it up until it reaches wasm_end_blocking_op, | ||||||
|  |      * which clears the BLOCKING bit. | ||||||
|  |      * | ||||||
|  |      * this dumb loop is necessary because posix doesn't provide | ||||||
|  |      * a way to unmask signal and block atomically. | ||||||
|  |      */ | ||||||
|  | 
 | ||||||
|  |     LOCK(env); | ||||||
|  |     SET(env, TERMINATE); | ||||||
|  |     while (ISSET(env, BLOCKING)) { | ||||||
|  |         UNLOCK(env); | ||||||
|  |         os_wakeup_blocking_op(env->handle); | ||||||
|  | 
 | ||||||
|  |         /* relax a bit */ | ||||||
|  |         os_usleep(50 * 1000); | ||||||
|  |         LOCK(env); | ||||||
|  |     } | ||||||
|  |     UNLOCK(env); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | #else /* WASM_ENABLE_THREAD_MGR && OS_ENABLE_WAKEUP_BLOCKING_OP */ | ||||||
|  | 
 | ||||||
|  | bool | ||||||
|  | wasm_runtime_begin_blocking_op(wasm_exec_env_t env) | ||||||
|  | { | ||||||
|  |     return true; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void | ||||||
|  | wasm_runtime_end_blocking_op(wasm_exec_env_t env) | ||||||
|  | {} | ||||||
|  | 
 | ||||||
|  | #endif /* WASM_ENABLE_THREAD_MGR && OS_ENABLE_WAKEUP_BLOCKING_OP */ | ||||||
|  | @ -457,8 +457,21 @@ wasm_runtime_env_init() | ||||||
|     } |     } | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | #if WASM_ENABLE_THREAD_MGR != 0 && defined(OS_ENABLE_WAKEUP_BLOCKING_OP) | ||||||
|  |     if (os_blocking_op_init() != BHT_OK) { | ||||||
|  |         goto fail11; | ||||||
|  |     } | ||||||
|  |     os_end_blocking_op(); | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|     return true; |     return true; | ||||||
| 
 | 
 | ||||||
|  | #if WASM_ENABLE_THREAD_MGR != 0 && defined(OS_ENABLE_WAKEUP_BLOCKING_OP) | ||||||
|  | fail11: | ||||||
|  | #if WASM_ENABLE_JIT != 0 || WASM_ENABLE_WAMR_COMPILER != 0 | ||||||
|  |     aot_compiler_destroy(); | ||||||
|  | #endif | ||||||
|  | #endif | ||||||
| #if WASM_ENABLE_JIT != 0 || WASM_ENABLE_WAMR_COMPILER != 0 | #if WASM_ENABLE_JIT != 0 || WASM_ENABLE_WAMR_COMPILER != 0 | ||||||
| fail10: | fail10: | ||||||
| #if WASM_ENABLE_FAST_JIT != 0 | #if WASM_ENABLE_FAST_JIT != 0 | ||||||
|  | @ -1392,6 +1405,10 @@ wasm_runtime_init_thread_env(void) | ||||||
|     } |     } | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | #if WASM_ENABLE_THREAD_MGR != 0 && defined(OS_ENABLE_WAKEUP_BLOCKING_OP) | ||||||
|  |     os_end_blocking_op(); | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1040,6 +1040,15 @@ WASM_RUNTIME_API_EXTERN bool | ||||||
| wasm_runtime_is_import_global_linked(const char *module_name, | wasm_runtime_is_import_global_linked(const char *module_name, | ||||||
|                                      const char *global_name); |                                      const char *global_name); | ||||||
| 
 | 
 | ||||||
|  | WASM_RUNTIME_API_EXTERN bool | ||||||
|  | wasm_runtime_begin_blocking_op(WASMExecEnv *exec_env); | ||||||
|  | 
 | ||||||
|  | WASM_RUNTIME_API_EXTERN void | ||||||
|  | wasm_runtime_end_blocking_op(WASMExecEnv *exec_env); | ||||||
|  | 
 | ||||||
|  | void | ||||||
|  | wasm_runtime_interrupt_blocking_op(WASMExecEnv *exec_env); | ||||||
|  | 
 | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | @ -20,6 +20,8 @@ extern "C" { | ||||||
| #define WASM_SUSPEND_FLAG_BREAKPOINT 0x4 | #define WASM_SUSPEND_FLAG_BREAKPOINT 0x4 | ||||||
| /* Return from pthread_exit */ | /* Return from pthread_exit */ | ||||||
| #define WASM_SUSPEND_FLAG_EXIT 0x8 | #define WASM_SUSPEND_FLAG_EXIT 0x8 | ||||||
|  | /* The thread might be blocking */ | ||||||
|  | #define WASM_SUSPEND_FLAG_BLOCKING 0x10 | ||||||
| 
 | 
 | ||||||
| typedef union WASMSuspendFlags { | typedef union WASMSuspendFlags { | ||||||
|     bh_atomic_32_t flags; |     bh_atomic_32_t flags; | ||||||
|  |  | ||||||
|  | @ -1546,6 +1546,50 @@ wasm_runtime_set_context_spread(wasm_module_inst_t inst, void *key, | ||||||
| WASM_RUNTIME_API_EXTERN void * | WASM_RUNTIME_API_EXTERN void * | ||||||
| wasm_runtime_get_context(wasm_module_inst_t inst, void *key); | wasm_runtime_get_context(wasm_module_inst_t inst, void *key); | ||||||
| 
 | 
 | ||||||
|  | /*
 | ||||||
|  |  * wasm_runtime_begin_blocking_op/wasm_runtime_end_blocking_op | ||||||
|  |  * | ||||||
|  |  * These APIs are intended to be used by the implementations of | ||||||
|  |  * host functions. It wraps an operation which possibly blocks for long | ||||||
|  |  * to prepare for async termination. | ||||||
|  |  * | ||||||
|  |  * eg. | ||||||
|  |  * | ||||||
|  |  *   if (!wasm_runtime_begin_blocking_op(exec_env)) { | ||||||
|  |  *       return EINTR; | ||||||
|  |  *   } | ||||||
|  |  *   ret = possibly_blocking_op(); | ||||||
|  |  *   wasm_runtime_end_blocking_op(exec_env); | ||||||
|  |  *   return ret; | ||||||
|  |  * | ||||||
|  |  * If threading support (WASM_ENABLE_THREAD_MGR) is not enabled, | ||||||
|  |  * these functions are no-op. | ||||||
|  |  * | ||||||
|  |  * If the underlying platform support (OS_ENABLE_WAKEUP_BLOCKING_OP) is | ||||||
|  |  * not available, these functions are no-op. In that case, the runtime | ||||||
|  |  * might not terminate a blocking thread in a timely manner. | ||||||
|  |  * | ||||||
|  |  * If the underlying platform support is available, it's used to wake up | ||||||
|  |  * the thread for async termination. The expectation here is that a | ||||||
|  |  * `os_wakeup_blocking_op` call makes the blocking operation | ||||||
|  |  * (`possibly_blocking_op` in the above example) return in a timely manner. | ||||||
|  |  * | ||||||
|  |  * The actual wake up mechanism used by `os_wakeup_blocking_op` is | ||||||
|  |  * platform-dependent. It might impose some platform-dependent restrictions | ||||||
|  |  * on the implementation of the blocking opearation. | ||||||
|  |  * | ||||||
|  |  * For example, on POSIX-like platforms, a signal (by default SIGUSR1) is | ||||||
|  |  * used. The signal delivery configurations (eg. signal handler, signal mask, | ||||||
|  |  * etc) for the signal are set up by the runtime. You can change the signal | ||||||
|  |  * to use for this purpose by calling os_set_signal_number_for_blocking_op | ||||||
|  |  * before the runtime initialization. | ||||||
|  |  */ | ||||||
|  | WASM_RUNTIME_API_EXTERN bool | ||||||
|  | wasm_runtime_begin_blocking_op(wasm_exec_env_t exec_env); | ||||||
|  | 
 | ||||||
|  | WASM_RUNTIME_API_EXTERN void | ||||||
|  | wasm_runtime_end_blocking_op(wasm_exec_env_t exec_env); | ||||||
|  | 
 | ||||||
| /* clang-format on */ | /* clang-format on */ | ||||||
| 
 | 
 | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
|  |  | ||||||
|  | @ -335,7 +335,7 @@ wasi_fd_close(wasm_exec_env_t exec_env, wasi_fd_t fd) | ||||||
|     if (!wasi_ctx) |     if (!wasi_ctx) | ||||||
|         return (wasi_errno_t)-1; |         return (wasi_errno_t)-1; | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_fd_close(curfds, prestats, fd); |     return wasmtime_ssp_fd_close(exec_env, curfds, prestats, fd); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -348,7 +348,7 @@ wasi_fd_datasync(wasm_exec_env_t exec_env, wasi_fd_t fd) | ||||||
|     if (!wasi_ctx) |     if (!wasi_ctx) | ||||||
|         return (wasi_errno_t)-1; |         return (wasi_errno_t)-1; | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_fd_datasync(curfds, fd); |     return wasmtime_ssp_fd_datasync(exec_env, curfds, fd); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -389,8 +389,8 @@ wasi_fd_pread(wasm_exec_env_t exec_env, wasi_fd_t fd, iovec_app_t *iovec_app, | ||||||
|         iovec->buf_len = iovec_app->buf_len; |         iovec->buf_len = iovec_app->buf_len; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     err = wasmtime_ssp_fd_pread(curfds, fd, iovec_begin, iovs_len, offset, |     err = wasmtime_ssp_fd_pread(exec_env, curfds, fd, iovec_begin, iovs_len, | ||||||
|                                 &nread); |                                 offset, &nread); | ||||||
|     if (err) |     if (err) | ||||||
|         goto fail; |         goto fail; | ||||||
| 
 | 
 | ||||||
|  | @ -443,8 +443,8 @@ wasi_fd_pwrite(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
|         ciovec->buf_len = iovec_app->buf_len; |         ciovec->buf_len = iovec_app->buf_len; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     err = wasmtime_ssp_fd_pwrite(curfds, fd, ciovec_begin, iovs_len, offset, |     err = wasmtime_ssp_fd_pwrite(exec_env, curfds, fd, ciovec_begin, iovs_len, | ||||||
|                                  &nwritten); |                                  offset, &nwritten); | ||||||
|     if (err) |     if (err) | ||||||
|         goto fail; |         goto fail; | ||||||
| 
 | 
 | ||||||
|  | @ -496,7 +496,8 @@ wasi_fd_read(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
|         iovec->buf_len = iovec_app->buf_len; |         iovec->buf_len = iovec_app->buf_len; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     err = wasmtime_ssp_fd_read(curfds, fd, iovec_begin, iovs_len, &nread); |     err = wasmtime_ssp_fd_read(exec_env, curfds, fd, iovec_begin, iovs_len, | ||||||
|  |                                &nread); | ||||||
|     if (err) |     if (err) | ||||||
|         goto fail; |         goto fail; | ||||||
| 
 | 
 | ||||||
|  | @ -521,7 +522,7 @@ wasi_fd_renumber(wasm_exec_env_t exec_env, wasi_fd_t from, wasi_fd_t to) | ||||||
|     if (!wasi_ctx) |     if (!wasi_ctx) | ||||||
|         return (wasi_errno_t)-1; |         return (wasi_errno_t)-1; | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_fd_renumber(curfds, prestats, from, to); |     return wasmtime_ssp_fd_renumber(exec_env, curfds, prestats, from, to); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -538,7 +539,8 @@ wasi_fd_seek(wasm_exec_env_t exec_env, wasi_fd_t fd, wasi_filedelta_t offset, | ||||||
|     if (!validate_native_addr(newoffset, sizeof(wasi_filesize_t))) |     if (!validate_native_addr(newoffset, sizeof(wasi_filesize_t))) | ||||||
|         return (wasi_errno_t)-1; |         return (wasi_errno_t)-1; | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_fd_seek(curfds, fd, offset, whence, newoffset); |     return wasmtime_ssp_fd_seek(exec_env, curfds, fd, offset, whence, | ||||||
|  |                                 newoffset); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -554,7 +556,7 @@ wasi_fd_tell(wasm_exec_env_t exec_env, wasi_fd_t fd, wasi_filesize_t *newoffset) | ||||||
|     if (!validate_native_addr(newoffset, sizeof(wasi_filesize_t))) |     if (!validate_native_addr(newoffset, sizeof(wasi_filesize_t))) | ||||||
|         return (wasi_errno_t)-1; |         return (wasi_errno_t)-1; | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_fd_tell(curfds, fd, newoffset); |     return wasmtime_ssp_fd_tell(exec_env, curfds, fd, newoffset); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -573,7 +575,7 @@ wasi_fd_fdstat_get(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
|     if (!validate_native_addr(fdstat_app, sizeof(wasi_fdstat_t))) |     if (!validate_native_addr(fdstat_app, sizeof(wasi_fdstat_t))) | ||||||
|         return (wasi_errno_t)-1; |         return (wasi_errno_t)-1; | ||||||
| 
 | 
 | ||||||
|     err = wasmtime_ssp_fd_fdstat_get(curfds, fd, &fdstat); |     err = wasmtime_ssp_fd_fdstat_get(exec_env, curfds, fd, &fdstat); | ||||||
|     if (err) |     if (err) | ||||||
|         return err; |         return err; | ||||||
| 
 | 
 | ||||||
|  | @ -592,7 +594,7 @@ wasi_fd_fdstat_set_flags(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
|     if (!wasi_ctx) |     if (!wasi_ctx) | ||||||
|         return (wasi_errno_t)-1; |         return (wasi_errno_t)-1; | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_fd_fdstat_set_flags(curfds, fd, flags); |     return wasmtime_ssp_fd_fdstat_set_flags(exec_env, curfds, fd, flags); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -607,8 +609,8 @@ wasi_fd_fdstat_set_rights(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
|     if (!wasi_ctx) |     if (!wasi_ctx) | ||||||
|         return (wasi_errno_t)-1; |         return (wasi_errno_t)-1; | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_fd_fdstat_set_rights(curfds, fd, fs_rights_base, |     return wasmtime_ssp_fd_fdstat_set_rights( | ||||||
|                                              fs_rights_inheriting); |         exec_env, curfds, fd, fs_rights_base, fs_rights_inheriting); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -621,7 +623,7 @@ wasi_fd_sync(wasm_exec_env_t exec_env, wasi_fd_t fd) | ||||||
|     if (!wasi_ctx) |     if (!wasi_ctx) | ||||||
|         return (wasi_errno_t)-1; |         return (wasi_errno_t)-1; | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_fd_sync(curfds, fd); |     return wasmtime_ssp_fd_sync(exec_env, curfds, fd); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -663,7 +665,8 @@ wasi_fd_write(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
|         ciovec->buf_len = iovec_app->buf_len; |         ciovec->buf_len = iovec_app->buf_len; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     err = wasmtime_ssp_fd_write(curfds, fd, ciovec_begin, iovs_len, &nwritten); |     err = wasmtime_ssp_fd_write(exec_env, curfds, fd, ciovec_begin, iovs_len, | ||||||
|  |                                 &nwritten); | ||||||
|     if (err) |     if (err) | ||||||
|         goto fail; |         goto fail; | ||||||
| 
 | 
 | ||||||
|  | @ -688,7 +691,7 @@ wasi_fd_advise(wasm_exec_env_t exec_env, wasi_fd_t fd, wasi_filesize_t offset, | ||||||
|     if (!wasi_ctx) |     if (!wasi_ctx) | ||||||
|         return (wasi_errno_t)-1; |         return (wasi_errno_t)-1; | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_fd_advise(curfds, fd, offset, len, advice); |     return wasmtime_ssp_fd_advise(exec_env, curfds, fd, offset, len, advice); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -702,7 +705,7 @@ wasi_fd_allocate(wasm_exec_env_t exec_env, wasi_fd_t fd, wasi_filesize_t offset, | ||||||
|     if (!wasi_ctx) |     if (!wasi_ctx) | ||||||
|         return (wasi_errno_t)-1; |         return (wasi_errno_t)-1; | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_fd_allocate(curfds, fd, offset, len); |     return wasmtime_ssp_fd_allocate(exec_env, curfds, fd, offset, len); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -716,7 +719,8 @@ wasi_path_create_directory(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
|     if (!wasi_ctx) |     if (!wasi_ctx) | ||||||
|         return (wasi_errno_t)-1; |         return (wasi_errno_t)-1; | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_path_create_directory(curfds, fd, path, path_len); |     return wasmtime_ssp_path_create_directory(exec_env, curfds, fd, path, | ||||||
|  |                                               path_len); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -733,8 +737,9 @@ wasi_path_link(wasm_exec_env_t exec_env, wasi_fd_t old_fd, | ||||||
|     if (!wasi_ctx) |     if (!wasi_ctx) | ||||||
|         return (wasi_errno_t)-1; |         return (wasi_errno_t)-1; | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_path_link(curfds, prestats, old_fd, old_flags, old_path, |     return wasmtime_ssp_path_link(exec_env, curfds, prestats, old_fd, old_flags, | ||||||
|                                   old_path_len, new_fd, new_path, new_path_len); |                                   old_path, old_path_len, new_fd, new_path, | ||||||
|  |                                   new_path_len); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -756,9 +761,9 @@ wasi_path_open(wasm_exec_env_t exec_env, wasi_fd_t dirfd, | ||||||
|     if (!validate_native_addr(fd_app, sizeof(wasi_fd_t))) |     if (!validate_native_addr(fd_app, sizeof(wasi_fd_t))) | ||||||
|         return (wasi_errno_t)-1; |         return (wasi_errno_t)-1; | ||||||
| 
 | 
 | ||||||
|     err = wasmtime_ssp_path_open(curfds, dirfd, dirflags, path, path_len, |     err = wasmtime_ssp_path_open(exec_env, curfds, dirfd, dirflags, path, | ||||||
|                                  oflags, fs_rights_base, fs_rights_inheriting, |                                  path_len, oflags, fs_rights_base, | ||||||
|                                  fs_flags, &fd); |                                  fs_rights_inheriting, fs_flags, &fd); | ||||||
| 
 | 
 | ||||||
|     *fd_app = fd; |     *fd_app = fd; | ||||||
|     return err; |     return err; | ||||||
|  | @ -780,7 +785,8 @@ wasi_fd_readdir(wasm_exec_env_t exec_env, wasi_fd_t fd, void *buf, | ||||||
|     if (!validate_native_addr(bufused_app, sizeof(uint32))) |     if (!validate_native_addr(bufused_app, sizeof(uint32))) | ||||||
|         return (wasi_errno_t)-1; |         return (wasi_errno_t)-1; | ||||||
| 
 | 
 | ||||||
|     err = wasmtime_ssp_fd_readdir(curfds, fd, buf, buf_len, cookie, &bufused); |     err = wasmtime_ssp_fd_readdir(exec_env, curfds, fd, buf, buf_len, cookie, | ||||||
|  |                                   &bufused); | ||||||
|     if (err) |     if (err) | ||||||
|         return err; |         return err; | ||||||
| 
 | 
 | ||||||
|  | @ -805,8 +811,8 @@ wasi_path_readlink(wasm_exec_env_t exec_env, wasi_fd_t fd, const char *path, | ||||||
|     if (!validate_native_addr(bufused_app, sizeof(uint32))) |     if (!validate_native_addr(bufused_app, sizeof(uint32))) | ||||||
|         return (wasi_errno_t)-1; |         return (wasi_errno_t)-1; | ||||||
| 
 | 
 | ||||||
|     err = wasmtime_ssp_path_readlink(curfds, fd, path, path_len, buf, buf_len, |     err = wasmtime_ssp_path_readlink(exec_env, curfds, fd, path, path_len, buf, | ||||||
|                                      &bufused); |                                      buf_len, &bufused); | ||||||
|     if (err) |     if (err) | ||||||
|         return err; |         return err; | ||||||
| 
 | 
 | ||||||
|  | @ -826,8 +832,9 @@ wasi_path_rename(wasm_exec_env_t exec_env, wasi_fd_t old_fd, | ||||||
|     if (!wasi_ctx) |     if (!wasi_ctx) | ||||||
|         return (wasi_errno_t)-1; |         return (wasi_errno_t)-1; | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_path_rename(curfds, old_fd, old_path, old_path_len, |     return wasmtime_ssp_path_rename(exec_env, curfds, old_fd, old_path, | ||||||
|                                     new_fd, new_path, new_path_len); |                                     old_path_len, new_fd, new_path, | ||||||
|  |                                     new_path_len); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -844,7 +851,7 @@ wasi_fd_filestat_get(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
|     if (!validate_native_addr(filestat, sizeof(wasi_filestat_t))) |     if (!validate_native_addr(filestat, sizeof(wasi_filestat_t))) | ||||||
|         return (wasi_errno_t)-1; |         return (wasi_errno_t)-1; | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_fd_filestat_get(curfds, fd, filestat); |     return wasmtime_ssp_fd_filestat_get(exec_env, curfds, fd, filestat); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -859,8 +866,8 @@ wasi_fd_filestat_set_times(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
|     if (!wasi_ctx) |     if (!wasi_ctx) | ||||||
|         return (wasi_errno_t)-1; |         return (wasi_errno_t)-1; | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_fd_filestat_set_times(curfds, fd, st_atim, st_mtim, |     return wasmtime_ssp_fd_filestat_set_times(exec_env, curfds, fd, st_atim, | ||||||
|                                               fstflags); |                                               st_mtim, fstflags); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -874,7 +881,7 @@ wasi_fd_filestat_set_size(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
|     if (!wasi_ctx) |     if (!wasi_ctx) | ||||||
|         return (wasi_errno_t)-1; |         return (wasi_errno_t)-1; | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_fd_filestat_set_size(curfds, fd, st_size); |     return wasmtime_ssp_fd_filestat_set_size(exec_env, curfds, fd, st_size); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -892,8 +899,8 @@ wasi_path_filestat_get(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
|     if (!validate_native_addr(filestat, sizeof(wasi_filestat_t))) |     if (!validate_native_addr(filestat, sizeof(wasi_filestat_t))) | ||||||
|         return (wasi_errno_t)-1; |         return (wasi_errno_t)-1; | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_path_filestat_get(curfds, fd, flags, path, path_len, |     return wasmtime_ssp_path_filestat_get(exec_env, curfds, fd, flags, path, | ||||||
|                                           filestat); |                                           path_len, filestat); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -909,8 +916,9 @@ wasi_path_filestat_set_times(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
|     if (!wasi_ctx) |     if (!wasi_ctx) | ||||||
|         return (wasi_errno_t)-1; |         return (wasi_errno_t)-1; | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_path_filestat_set_times( |     return wasmtime_ssp_path_filestat_set_times(exec_env, curfds, fd, flags, | ||||||
|         curfds, fd, flags, path, path_len, st_atim, st_mtim, fstflags); |                                                 path, path_len, st_atim, | ||||||
|  |                                                 st_mtim, fstflags); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -926,8 +934,8 @@ wasi_path_symlink(wasm_exec_env_t exec_env, const char *old_path, | ||||||
|     if (!wasi_ctx) |     if (!wasi_ctx) | ||||||
|         return (wasi_errno_t)-1; |         return (wasi_errno_t)-1; | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_path_symlink(curfds, prestats, old_path, old_path_len, |     return wasmtime_ssp_path_symlink(exec_env, curfds, prestats, old_path, | ||||||
|                                      fd, new_path, new_path_len); |                                      old_path_len, fd, new_path, new_path_len); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -941,7 +949,7 @@ wasi_path_unlink_file(wasm_exec_env_t exec_env, wasi_fd_t fd, const char *path, | ||||||
|     if (!wasi_ctx) |     if (!wasi_ctx) | ||||||
|         return (wasi_errno_t)-1; |         return (wasi_errno_t)-1; | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_path_unlink_file(curfds, fd, path, path_len); |     return wasmtime_ssp_path_unlink_file(exec_env, curfds, fd, path, path_len); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -955,7 +963,8 @@ wasi_path_remove_directory(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
|     if (!wasi_ctx) |     if (!wasi_ctx) | ||||||
|         return (wasi_errno_t)-1; |         return (wasi_errno_t)-1; | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_path_remove_directory(curfds, fd, path, path_len); |     return wasmtime_ssp_path_remove_directory(exec_env, curfds, fd, path, | ||||||
|  |                                               path_len); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #if WASM_ENABLE_THREAD_MGR != 0 | #if WASM_ENABLE_THREAD_MGR != 0 | ||||||
|  | @ -1026,8 +1035,8 @@ execute_interruptible_poll_oneoff( | ||||||
|         /* update timeout for clock subscription events */ |         /* update timeout for clock subscription events */ | ||||||
|         update_clock_subscription_data( |         update_clock_subscription_data( | ||||||
|             in_copy, nsubscriptions, min_uint64(time_quant, timeout - elapsed)); |             in_copy, nsubscriptions, min_uint64(time_quant, timeout - elapsed)); | ||||||
|         err = wasmtime_ssp_poll_oneoff(curfds, in_copy, out, nsubscriptions, |         err = wasmtime_ssp_poll_oneoff(exec_env, curfds, in_copy, out, | ||||||
|                                        nevents); |                                        nsubscriptions, nevents); | ||||||
|         elapsed += time_quant; |         elapsed += time_quant; | ||||||
| 
 | 
 | ||||||
|         if (err) { |         if (err) { | ||||||
|  | @ -1079,7 +1088,8 @@ wasi_poll_oneoff(wasm_exec_env_t exec_env, const wasi_subscription_t *in, | ||||||
|         return (wasi_errno_t)-1; |         return (wasi_errno_t)-1; | ||||||
| 
 | 
 | ||||||
| #if WASM_ENABLE_THREAD_MGR == 0 | #if WASM_ENABLE_THREAD_MGR == 0 | ||||||
|     err = wasmtime_ssp_poll_oneoff(curfds, in, out, nsubscriptions, &nevents); |     err = wasmtime_ssp_poll_oneoff(exec_env, curfds, in, out, nsubscriptions, | ||||||
|  |                                    &nevents); | ||||||
| #else | #else | ||||||
|     err = execute_interruptible_poll_oneoff(curfds, in, out, nsubscriptions, |     err = execute_interruptible_poll_oneoff(curfds, in, out, nsubscriptions, | ||||||
|                                             &nevents, exec_env); |                                             &nevents, exec_env); | ||||||
|  | @ -1133,7 +1143,7 @@ wasi_sock_accept(wasm_exec_env_t exec_env, wasi_fd_t fd, wasi_fdflags_t flags, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasi_ssp_sock_accept(curfds, fd, flags, fd_new); |     return wasi_ssp_sock_accept(exec_env, curfds, fd, flags, fd_new); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1152,7 +1162,7 @@ wasi_sock_addr_local(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasi_ssp_sock_addr_local(curfds, fd, addr); |     return wasi_ssp_sock_addr_local(exec_env, curfds, fd, addr); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1171,7 +1181,7 @@ wasi_sock_addr_remote(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasi_ssp_sock_addr_remote(curfds, fd, addr); |     return wasi_ssp_sock_addr_remote(exec_env, curfds, fd, addr); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1192,8 +1202,8 @@ wasi_sock_addr_resolve(wasm_exec_env_t exec_env, const char *host, | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
|     ns_lookup_list = wasi_ctx_get_ns_lookup_list(wasi_ctx); |     ns_lookup_list = wasi_ctx_get_ns_lookup_list(wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasi_ssp_sock_addr_resolve(curfds, ns_lookup_list, host, service, |     return wasi_ssp_sock_addr_resolve(exec_env, curfds, ns_lookup_list, host, | ||||||
|                                       hints, addr_info, addr_info_size, |                                       service, hints, addr_info, addr_info_size, | ||||||
|                                       max_info_size); |                                       max_info_size); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -1211,7 +1221,7 @@ wasi_sock_bind(wasm_exec_env_t exec_env, wasi_fd_t fd, wasi_addr_t *addr) | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
|     addr_pool = wasi_ctx_get_addr_pool(module_inst, wasi_ctx); |     addr_pool = wasi_ctx_get_addr_pool(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasi_ssp_sock_bind(curfds, addr_pool, fd, addr); |     return wasi_ssp_sock_bind(exec_env, curfds, addr_pool, fd, addr); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1234,7 +1244,7 @@ wasi_sock_connect(wasm_exec_env_t exec_env, wasi_fd_t fd, wasi_addr_t *addr) | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
|     addr_pool = wasi_ctx_get_addr_pool(module_inst, wasi_ctx); |     addr_pool = wasi_ctx_get_addr_pool(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasi_ssp_sock_connect(curfds, addr_pool, fd, addr); |     return wasi_ssp_sock_connect(exec_env, curfds, addr_pool, fd, addr); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1253,7 +1263,7 @@ wasi_sock_get_broadcast(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_get_broadcast(curfds, fd, is_enabled); |     return wasmtime_ssp_sock_get_broadcast(exec_env, curfds, fd, is_enabled); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1272,7 +1282,7 @@ wasi_sock_get_keep_alive(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_get_keep_alive(curfds, fd, is_enabled); |     return wasmtime_ssp_sock_get_keep_alive(exec_env, curfds, fd, is_enabled); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1292,7 +1302,8 @@ wasi_sock_get_linger(wasm_exec_env_t exec_env, wasi_fd_t fd, bool *is_enabled, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_get_linger(curfds, fd, is_enabled, linger_s); |     return wasmtime_ssp_sock_get_linger(exec_env, curfds, fd, is_enabled, | ||||||
|  |                                         linger_s); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1311,7 +1322,7 @@ wasi_sock_get_recv_buf_size(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_get_recv_buf_size(curfds, fd, size); |     return wasmtime_ssp_sock_get_recv_buf_size(exec_env, curfds, fd, size); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1330,7 +1341,7 @@ wasi_sock_get_recv_timeout(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_get_recv_timeout(curfds, fd, timeout_us); |     return wasmtime_ssp_sock_get_recv_timeout(exec_env, curfds, fd, timeout_us); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1349,7 +1360,7 @@ wasi_sock_get_reuse_addr(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_get_reuse_addr(curfds, fd, is_enabled); |     return wasmtime_ssp_sock_get_reuse_addr(exec_env, curfds, fd, is_enabled); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1368,7 +1379,7 @@ wasi_sock_get_reuse_port(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_get_reuse_port(curfds, fd, is_enabled); |     return wasmtime_ssp_sock_get_reuse_port(exec_env, curfds, fd, is_enabled); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1387,7 +1398,7 @@ wasi_sock_get_send_buf_size(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_get_send_buf_size(curfds, fd, size); |     return wasmtime_ssp_sock_get_send_buf_size(exec_env, curfds, fd, size); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1406,7 +1417,7 @@ wasi_sock_get_send_timeout(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_get_send_timeout(curfds, fd, timeout_us); |     return wasmtime_ssp_sock_get_send_timeout(exec_env, curfds, fd, timeout_us); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1425,7 +1436,8 @@ wasi_sock_get_tcp_fastopen_connect(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_get_tcp_fastopen_connect(curfds, fd, is_enabled); |     return wasmtime_ssp_sock_get_tcp_fastopen_connect(exec_env, curfds, fd, | ||||||
|  |                                                       is_enabled); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1444,7 +1456,7 @@ wasi_sock_get_tcp_no_delay(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_get_tcp_no_delay(curfds, fd, is_enabled); |     return wasmtime_ssp_sock_get_tcp_no_delay(exec_env, curfds, fd, is_enabled); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1463,7 +1475,8 @@ wasi_sock_get_tcp_quick_ack(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_get_tcp_quick_ack(curfds, fd, is_enabled); |     return wasmtime_ssp_sock_get_tcp_quick_ack(exec_env, curfds, fd, | ||||||
|  |                                                is_enabled); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1482,7 +1495,7 @@ wasi_sock_get_tcp_keep_idle(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_get_tcp_keep_idle(curfds, fd, time_s); |     return wasmtime_ssp_sock_get_tcp_keep_idle(exec_env, curfds, fd, time_s); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1501,7 +1514,7 @@ wasi_sock_get_tcp_keep_intvl(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_get_tcp_keep_intvl(curfds, fd, time_s); |     return wasmtime_ssp_sock_get_tcp_keep_intvl(exec_env, curfds, fd, time_s); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1520,7 +1533,7 @@ wasi_sock_get_ip_multicast_loop(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_get_ip_multicast_loop(curfds, fd, ipv6, |     return wasmtime_ssp_sock_get_ip_multicast_loop(exec_env, curfds, fd, ipv6, | ||||||
|                                                    is_enabled); |                                                    is_enabled); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -1539,7 +1552,7 @@ wasi_sock_get_ip_ttl(wasm_exec_env_t exec_env, wasi_fd_t fd, uint8_t *ttl_s) | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_get_ip_ttl(curfds, fd, ttl_s); |     return wasmtime_ssp_sock_get_ip_ttl(exec_env, curfds, fd, ttl_s); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1558,7 +1571,7 @@ wasi_sock_get_ip_multicast_ttl(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_get_ip_multicast_ttl(curfds, fd, ttl_s); |     return wasmtime_ssp_sock_get_ip_multicast_ttl(exec_env, curfds, fd, ttl_s); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1577,7 +1590,7 @@ wasi_sock_get_ipv6_only(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_get_ipv6_only(curfds, fd, is_enabled); |     return wasmtime_ssp_sock_get_ipv6_only(exec_env, curfds, fd, is_enabled); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1592,7 +1605,7 @@ wasi_sock_listen(wasm_exec_env_t exec_env, wasi_fd_t fd, uint32 backlog) | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasi_ssp_sock_listen(curfds, fd, backlog); |     return wasi_ssp_sock_listen(exec_env, curfds, fd, backlog); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1609,7 +1622,7 @@ wasi_sock_open(wasm_exec_env_t exec_env, wasi_fd_t poolfd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasi_ssp_sock_open(curfds, poolfd, af, socktype, sockfd); |     return wasi_ssp_sock_open(exec_env, curfds, poolfd, af, socktype, sockfd); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1624,7 +1637,7 @@ wasi_sock_set_broadcast(wasm_exec_env_t exec_env, wasi_fd_t fd, bool is_enabled) | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_set_broadcast(curfds, fd, is_enabled); |     return wasmtime_ssp_sock_set_broadcast(exec_env, curfds, fd, is_enabled); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1640,7 +1653,7 @@ wasi_sock_set_keep_alive(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_set_keep_alive(curfds, fd, is_enabled); |     return wasmtime_ssp_sock_set_keep_alive(exec_env, curfds, fd, is_enabled); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1656,7 +1669,8 @@ wasi_sock_set_linger(wasm_exec_env_t exec_env, wasi_fd_t fd, bool is_enabled, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_set_linger(curfds, fd, is_enabled, linger_s); |     return wasmtime_ssp_sock_set_linger(exec_env, curfds, fd, is_enabled, | ||||||
|  |                                         linger_s); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1671,7 +1685,7 @@ wasi_sock_set_recv_buf_size(wasm_exec_env_t exec_env, wasi_fd_t fd, size_t size) | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_set_recv_buf_size(curfds, fd, size); |     return wasmtime_ssp_sock_set_recv_buf_size(exec_env, curfds, fd, size); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1687,7 +1701,7 @@ wasi_sock_set_recv_timeout(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_set_recv_timeout(curfds, fd, timeout_us); |     return wasmtime_ssp_sock_set_recv_timeout(exec_env, curfds, fd, timeout_us); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1703,7 +1717,7 @@ wasi_sock_set_reuse_addr(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_set_reuse_addr(curfds, fd, is_enabled); |     return wasmtime_ssp_sock_set_reuse_addr(exec_env, curfds, fd, is_enabled); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1719,7 +1733,7 @@ wasi_sock_set_reuse_port(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_set_reuse_port(curfds, fd, is_enabled); |     return wasmtime_ssp_sock_set_reuse_port(exec_env, curfds, fd, is_enabled); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1734,7 +1748,7 @@ wasi_sock_set_send_buf_size(wasm_exec_env_t exec_env, wasi_fd_t fd, size_t size) | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_set_send_buf_size(curfds, fd, size); |     return wasmtime_ssp_sock_set_send_buf_size(exec_env, curfds, fd, size); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1750,7 +1764,7 @@ wasi_sock_set_send_timeout(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_set_send_timeout(curfds, fd, timeout_us); |     return wasmtime_ssp_sock_set_send_timeout(exec_env, curfds, fd, timeout_us); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1766,7 +1780,8 @@ wasi_sock_set_tcp_fastopen_connect(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_set_tcp_fastopen_connect(curfds, fd, is_enabled); |     return wasmtime_ssp_sock_set_tcp_fastopen_connect(exec_env, curfds, fd, | ||||||
|  |                                                       is_enabled); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1782,7 +1797,7 @@ wasi_sock_set_tcp_no_delay(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_set_tcp_no_delay(curfds, fd, is_enabled); |     return wasmtime_ssp_sock_set_tcp_no_delay(exec_env, curfds, fd, is_enabled); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1798,7 +1813,8 @@ wasi_sock_set_tcp_quick_ack(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_set_tcp_quick_ack(curfds, fd, is_enabled); |     return wasmtime_ssp_sock_set_tcp_quick_ack(exec_env, curfds, fd, | ||||||
|  |                                                is_enabled); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1814,7 +1830,7 @@ wasi_sock_set_tcp_keep_idle(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_set_tcp_keep_idle(curfds, fd, time_s); |     return wasmtime_ssp_sock_set_tcp_keep_idle(exec_env, curfds, fd, time_s); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1830,7 +1846,7 @@ wasi_sock_set_tcp_keep_intvl(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_set_tcp_keep_intvl(curfds, fd, time_s); |     return wasmtime_ssp_sock_set_tcp_keep_intvl(exec_env, curfds, fd, time_s); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1846,7 +1862,7 @@ wasi_sock_set_ip_multicast_loop(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_set_ip_multicast_loop(curfds, fd, ipv6, |     return wasmtime_ssp_sock_set_ip_multicast_loop(exec_env, curfds, fd, ipv6, | ||||||
|                                                    is_enabled); |                                                    is_enabled); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -1867,8 +1883,8 @@ wasi_sock_set_ip_add_membership(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_set_ip_add_membership(curfds, fd, imr_multiaddr, |     return wasmtime_ssp_sock_set_ip_add_membership( | ||||||
|                                                    imr_interface); |         exec_env, curfds, fd, imr_multiaddr, imr_interface); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1888,8 +1904,8 @@ wasi_sock_set_ip_drop_membership(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_set_ip_drop_membership(curfds, fd, imr_multiaddr, |     return wasmtime_ssp_sock_set_ip_drop_membership( | ||||||
|                                                     imr_interface); |         exec_env, curfds, fd, imr_multiaddr, imr_interface); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1904,7 +1920,7 @@ wasi_sock_set_ip_ttl(wasm_exec_env_t exec_env, wasi_fd_t fd, uint8_t ttl_s) | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_set_ip_ttl(curfds, fd, ttl_s); |     return wasmtime_ssp_sock_set_ip_ttl(exec_env, curfds, fd, ttl_s); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1920,7 +1936,7 @@ wasi_sock_set_ip_multicast_ttl(wasm_exec_env_t exec_env, wasi_fd_t fd, | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_set_ip_multicast_ttl(curfds, fd, ttl_s); |     return wasmtime_ssp_sock_set_ip_multicast_ttl(exec_env, curfds, fd, ttl_s); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -1935,7 +1951,7 @@ wasi_sock_set_ipv6_only(wasm_exec_env_t exec_env, wasi_fd_t fd, bool is_enabled) | ||||||
| 
 | 
 | ||||||
|     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); |     curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx); | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_set_ipv6_only(curfds, fd, is_enabled); |     return wasmtime_ssp_sock_set_ipv6_only(exec_env, curfds, fd, is_enabled); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  | @ -2053,8 +2069,9 @@ wasi_sock_recv_from(wasm_exec_env_t exec_env, wasi_fd_t sock, | ||||||
|     memset(buf_begin, 0, total_size); |     memset(buf_begin, 0, total_size); | ||||||
| 
 | 
 | ||||||
|     *ro_data_len = 0; |     *ro_data_len = 0; | ||||||
|     err = wasmtime_ssp_sock_recv_from(curfds, sock, buf_begin, total_size, |     err = wasmtime_ssp_sock_recv_from(exec_env, curfds, sock, buf_begin, | ||||||
|                                       ri_flags, src_addr, &recv_bytes); |                                       total_size, ri_flags, src_addr, | ||||||
|  |                                       &recv_bytes); | ||||||
|     if (err != __WASI_ESUCCESS) { |     if (err != __WASI_ESUCCESS) { | ||||||
|         goto fail; |         goto fail; | ||||||
|     } |     } | ||||||
|  | @ -2153,7 +2170,8 @@ wasi_sock_send(wasm_exec_env_t exec_env, wasi_fd_t sock, | ||||||
|         return err; |         return err; | ||||||
| 
 | 
 | ||||||
|     *so_data_len = 0; |     *so_data_len = 0; | ||||||
|     err = wasmtime_ssp_sock_send(curfds, sock, buf, buf_size, &send_bytes); |     err = wasmtime_ssp_sock_send(exec_env, curfds, sock, buf, buf_size, | ||||||
|  |                                  &send_bytes); | ||||||
|     *so_data_len = (uint32)send_bytes; |     *so_data_len = (uint32)send_bytes; | ||||||
| 
 | 
 | ||||||
|     wasm_runtime_free(buf); |     wasm_runtime_free(buf); | ||||||
|  | @ -2193,8 +2211,8 @@ wasi_sock_send_to(wasm_exec_env_t exec_env, wasi_fd_t sock, | ||||||
|         return err; |         return err; | ||||||
| 
 | 
 | ||||||
|     *so_data_len = 0; |     *so_data_len = 0; | ||||||
|     err = wasmtime_ssp_sock_send_to(curfds, addr_pool, sock, buf, buf_size, |     err = wasmtime_ssp_sock_send_to(exec_env, curfds, addr_pool, sock, buf, | ||||||
|                                     si_flags, dest_addr, &send_bytes); |                                     buf_size, si_flags, dest_addr, &send_bytes); | ||||||
|     *so_data_len = (uint32)send_bytes; |     *so_data_len = (uint32)send_bytes; | ||||||
| 
 | 
 | ||||||
|     wasm_runtime_free(buf); |     wasm_runtime_free(buf); | ||||||
|  | @ -2212,7 +2230,7 @@ wasi_sock_shutdown(wasm_exec_env_t exec_env, wasi_fd_t sock, wasi_sdflags_t how) | ||||||
|     if (!wasi_ctx) |     if (!wasi_ctx) | ||||||
|         return __WASI_EINVAL; |         return __WASI_EINVAL; | ||||||
| 
 | 
 | ||||||
|     return wasmtime_ssp_sock_shutdown(curfds, sock); |     return wasmtime_ssp_sock_shutdown(exec_env, curfds, sock); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static wasi_errno_t | static wasi_errno_t | ||||||
|  |  | ||||||
|  | @ -22,6 +22,8 @@ | ||||||
| #include <stddef.h> | #include <stddef.h> | ||||||
| #include <stdint.h> | #include <stdint.h> | ||||||
| 
 | 
 | ||||||
|  | #include "wasm_export.h" | ||||||
|  | 
 | ||||||
| /* clang-format off */ | /* clang-format off */ | ||||||
| 
 | 
 | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
|  | @ -646,17 +648,20 @@ __wasi_errno_t wasmtime_ssp_fd_prestat_dir_name( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(fd_prestat_dir_name) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(fd_prestat_dir_name) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_fd_close( | __wasi_errno_t wasmtime_ssp_fd_close( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     struct fd_prestats *prestats, |     struct fd_prestats *prestats, | ||||||
|     __wasi_fd_t fd |     __wasi_fd_t fd | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(fd_close) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(fd_close) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_fd_datasync( | __wasi_errno_t wasmtime_ssp_fd_datasync( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd |     __wasi_fd_t fd | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(fd_datasync) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(fd_datasync) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_fd_pread( | __wasi_errno_t wasmtime_ssp_fd_pread( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, |     __wasi_fd_t fd, | ||||||
|     const __wasi_iovec_t *iovs, |     const __wasi_iovec_t *iovs, | ||||||
|  | @ -666,6 +671,7 @@ __wasi_errno_t wasmtime_ssp_fd_pread( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(fd_pread) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(fd_pread) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_fd_pwrite( | __wasi_errno_t wasmtime_ssp_fd_pwrite( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, |     __wasi_fd_t fd, | ||||||
|     const __wasi_ciovec_t *iovs, |     const __wasi_ciovec_t *iovs, | ||||||
|  | @ -675,6 +681,7 @@ __wasi_errno_t wasmtime_ssp_fd_pwrite( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(fd_pwrite) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(fd_pwrite) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_fd_read( | __wasi_errno_t wasmtime_ssp_fd_read( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, |     __wasi_fd_t fd, | ||||||
|     const __wasi_iovec_t *iovs, |     const __wasi_iovec_t *iovs, | ||||||
|  | @ -683,6 +690,7 @@ __wasi_errno_t wasmtime_ssp_fd_read( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(fd_read) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(fd_read) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_fd_renumber( | __wasi_errno_t wasmtime_ssp_fd_renumber( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     struct fd_prestats *prestats, |     struct fd_prestats *prestats, | ||||||
|     __wasi_fd_t from, |     __wasi_fd_t from, | ||||||
|  | @ -690,6 +698,7 @@ __wasi_errno_t wasmtime_ssp_fd_renumber( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(fd_renumber) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(fd_renumber) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_fd_seek( | __wasi_errno_t wasmtime_ssp_fd_seek( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, |     __wasi_fd_t fd, | ||||||
|     __wasi_filedelta_t offset, |     __wasi_filedelta_t offset, | ||||||
|  | @ -698,24 +707,28 @@ __wasi_errno_t wasmtime_ssp_fd_seek( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(fd_seek) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(fd_seek) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_fd_tell( | __wasi_errno_t wasmtime_ssp_fd_tell( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, |     __wasi_fd_t fd, | ||||||
|     __wasi_filesize_t *newoffset |     __wasi_filesize_t *newoffset | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(fd_tell) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(fd_tell) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_fd_fdstat_get( | __wasi_errno_t wasmtime_ssp_fd_fdstat_get( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, |     __wasi_fd_t fd, | ||||||
|     __wasi_fdstat_t *buf |     __wasi_fdstat_t *buf | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(fd_fdstat_get) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(fd_fdstat_get) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_fd_fdstat_set_flags( | __wasi_errno_t wasmtime_ssp_fd_fdstat_set_flags( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, |     __wasi_fd_t fd, | ||||||
|     __wasi_fdflags_t flags |     __wasi_fdflags_t flags | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(fd_fdstat_set_flags) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(fd_fdstat_set_flags) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_fd_fdstat_set_rights( | __wasi_errno_t wasmtime_ssp_fd_fdstat_set_rights( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, |     __wasi_fd_t fd, | ||||||
|     __wasi_rights_t fs_rights_base, |     __wasi_rights_t fs_rights_base, | ||||||
|  | @ -723,11 +736,13 @@ __wasi_errno_t wasmtime_ssp_fd_fdstat_set_rights( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(fd_fdstat_set_rights) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(fd_fdstat_set_rights) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_fd_sync( | __wasi_errno_t wasmtime_ssp_fd_sync( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd |     __wasi_fd_t fd | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(fd_sync) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(fd_sync) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_fd_write( | __wasi_errno_t wasmtime_ssp_fd_write( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, |     __wasi_fd_t fd, | ||||||
|     const __wasi_ciovec_t *iovs, |     const __wasi_ciovec_t *iovs, | ||||||
|  | @ -736,6 +751,7 @@ __wasi_errno_t wasmtime_ssp_fd_write( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(fd_write) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(fd_write) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_fd_advise( | __wasi_errno_t wasmtime_ssp_fd_advise( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, |     __wasi_fd_t fd, | ||||||
|     __wasi_filesize_t offset, |     __wasi_filesize_t offset, | ||||||
|  | @ -744,6 +760,7 @@ __wasi_errno_t wasmtime_ssp_fd_advise( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(fd_advise) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(fd_advise) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_fd_allocate( | __wasi_errno_t wasmtime_ssp_fd_allocate( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, |     __wasi_fd_t fd, | ||||||
|     __wasi_filesize_t offset, |     __wasi_filesize_t offset, | ||||||
|  | @ -751,6 +768,7 @@ __wasi_errno_t wasmtime_ssp_fd_allocate( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(fd_allocate) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(fd_allocate) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_path_create_directory( | __wasi_errno_t wasmtime_ssp_path_create_directory( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, |     __wasi_fd_t fd, | ||||||
|     const char *path, |     const char *path, | ||||||
|  | @ -758,6 +776,7 @@ __wasi_errno_t wasmtime_ssp_path_create_directory( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(path_create_directory) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(path_create_directory) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_path_link( | __wasi_errno_t wasmtime_ssp_path_link( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     struct fd_prestats *prestats, |     struct fd_prestats *prestats, | ||||||
|     __wasi_fd_t old_fd, |     __wasi_fd_t old_fd, | ||||||
|  | @ -770,6 +789,7 @@ __wasi_errno_t wasmtime_ssp_path_link( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(path_link) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(path_link) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_path_open( | __wasi_errno_t wasmtime_ssp_path_open( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t dirfd, |     __wasi_fd_t dirfd, | ||||||
|     __wasi_lookupflags_t dirflags, |     __wasi_lookupflags_t dirflags, | ||||||
|  | @ -783,6 +803,7 @@ __wasi_errno_t wasmtime_ssp_path_open( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(path_open) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(path_open) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_fd_readdir( | __wasi_errno_t wasmtime_ssp_fd_readdir( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, |     __wasi_fd_t fd, | ||||||
|     void *buf, |     void *buf, | ||||||
|  | @ -792,6 +813,7 @@ __wasi_errno_t wasmtime_ssp_fd_readdir( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(fd_readdir) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(fd_readdir) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_path_readlink( | __wasi_errno_t wasmtime_ssp_path_readlink( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, |     __wasi_fd_t fd, | ||||||
|     const char *path, |     const char *path, | ||||||
|  | @ -802,6 +824,7 @@ __wasi_errno_t wasmtime_ssp_path_readlink( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(path_readlink) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(path_readlink) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_path_rename( | __wasi_errno_t wasmtime_ssp_path_rename( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t old_fd, |     __wasi_fd_t old_fd, | ||||||
|     const char *old_path, |     const char *old_path, | ||||||
|  | @ -812,12 +835,14 @@ __wasi_errno_t wasmtime_ssp_path_rename( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(path_rename) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(path_rename) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_fd_filestat_get( | __wasi_errno_t wasmtime_ssp_fd_filestat_get( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, |     __wasi_fd_t fd, | ||||||
|     __wasi_filestat_t *buf |     __wasi_filestat_t *buf | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(fd_filestat_get) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(fd_filestat_get) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_fd_filestat_set_times( | __wasi_errno_t wasmtime_ssp_fd_filestat_set_times( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, |     __wasi_fd_t fd, | ||||||
|     __wasi_timestamp_t st_atim, |     __wasi_timestamp_t st_atim, | ||||||
|  | @ -826,12 +851,14 @@ __wasi_errno_t wasmtime_ssp_fd_filestat_set_times( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(fd_filestat_set_times) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(fd_filestat_set_times) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_fd_filestat_set_size( | __wasi_errno_t wasmtime_ssp_fd_filestat_set_size( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, |     __wasi_fd_t fd, | ||||||
|     __wasi_filesize_t st_size |     __wasi_filesize_t st_size | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(fd_filestat_set_size) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(fd_filestat_set_size) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_path_filestat_get( | __wasi_errno_t wasmtime_ssp_path_filestat_get( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, |     __wasi_fd_t fd, | ||||||
|     __wasi_lookupflags_t flags, |     __wasi_lookupflags_t flags, | ||||||
|  | @ -841,6 +868,7 @@ __wasi_errno_t wasmtime_ssp_path_filestat_get( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(path_filestat_get) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(path_filestat_get) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_path_filestat_set_times( | __wasi_errno_t wasmtime_ssp_path_filestat_set_times( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, |     __wasi_fd_t fd, | ||||||
|     __wasi_lookupflags_t flags, |     __wasi_lookupflags_t flags, | ||||||
|  | @ -852,6 +880,7 @@ __wasi_errno_t wasmtime_ssp_path_filestat_set_times( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(path_filestat_set_times) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(path_filestat_set_times) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_path_symlink( | __wasi_errno_t wasmtime_ssp_path_symlink( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     struct fd_prestats *prestats, |     struct fd_prestats *prestats, | ||||||
|     const char *old_path, |     const char *old_path, | ||||||
|  | @ -862,6 +891,7 @@ __wasi_errno_t wasmtime_ssp_path_symlink( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(path_symlink) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(path_symlink) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_path_unlink_file( | __wasi_errno_t wasmtime_ssp_path_unlink_file( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, |     __wasi_fd_t fd, | ||||||
|     const char *path, |     const char *path, | ||||||
|  | @ -869,6 +899,7 @@ __wasi_errno_t wasmtime_ssp_path_unlink_file( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(path_unlink_file) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(path_unlink_file) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_path_remove_directory( | __wasi_errno_t wasmtime_ssp_path_remove_directory( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, |     __wasi_fd_t fd, | ||||||
|     const char *path, |     const char *path, | ||||||
|  | @ -876,6 +907,7 @@ __wasi_errno_t wasmtime_ssp_path_remove_directory( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(path_remove_directory) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(path_remove_directory) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_poll_oneoff( | __wasi_errno_t wasmtime_ssp_poll_oneoff( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     const __wasi_subscription_t *in, |     const __wasi_subscription_t *in, | ||||||
|     __wasi_event_t *out, |     __wasi_event_t *out, | ||||||
|  | @ -890,24 +922,28 @@ __wasi_errno_t wasmtime_ssp_random_get( | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t | __wasi_errno_t | ||||||
| wasi_ssp_sock_accept( | wasi_ssp_sock_accept( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, __wasi_fdflags_t flags, __wasi_fd_t *fd_new |     __wasi_fd_t fd, __wasi_fdflags_t flags, __wasi_fd_t *fd_new | ||||||
| ) __attribute__((__warn_unused_result__)); | ) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t | __wasi_errno_t | ||||||
| wasi_ssp_sock_addr_local( | wasi_ssp_sock_addr_local( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, __wasi_addr_t *addr |     __wasi_fd_t fd, __wasi_addr_t *addr | ||||||
| ) __attribute__((__warn_unused_result__)); | ) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t | __wasi_errno_t | ||||||
| wasi_ssp_sock_addr_remote( | wasi_ssp_sock_addr_remote( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, __wasi_addr_t *addr |     __wasi_fd_t fd, __wasi_addr_t *addr | ||||||
| ) __attribute__((__warn_unused_result__)); | ) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t | __wasi_errno_t | ||||||
| wasi_ssp_sock_open( | wasi_ssp_sock_open( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t poolfd, __wasi_address_family_t af, __wasi_sock_type_t socktype, |     __wasi_fd_t poolfd, __wasi_address_family_t af, __wasi_sock_type_t socktype, | ||||||
|     __wasi_fd_t *sockfd |     __wasi_fd_t *sockfd | ||||||
|  | @ -915,12 +951,14 @@ wasi_ssp_sock_open( | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t | __wasi_errno_t | ||||||
| wasi_ssp_sock_bind( | wasi_ssp_sock_bind( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, struct addr_pool *addr_pool, |     struct fd_table *curfds, struct addr_pool *addr_pool, | ||||||
|     __wasi_fd_t fd, __wasi_addr_t *addr |     __wasi_fd_t fd, __wasi_addr_t *addr | ||||||
| ) __attribute__((__warn_unused_result__)); | ) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t | __wasi_errno_t | ||||||
| wasi_ssp_sock_addr_resolve( | wasi_ssp_sock_addr_resolve( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, char **ns_lookup_list, |     struct fd_table *curfds, char **ns_lookup_list, | ||||||
|     const char *host, const char* service, |     const char *host, const char* service, | ||||||
|     __wasi_addr_info_hints_t *hints, __wasi_addr_info_t *addr_info, |     __wasi_addr_info_hints_t *hints, __wasi_addr_info_t *addr_info, | ||||||
|  | @ -929,65 +967,76 @@ wasi_ssp_sock_addr_resolve( | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t | __wasi_errno_t | ||||||
| wasi_ssp_sock_connect( | wasi_ssp_sock_connect( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, struct addr_pool *addr_pool, |     struct fd_table *curfds, struct addr_pool *addr_pool, | ||||||
|     __wasi_fd_t fd, __wasi_addr_t *addr |     __wasi_fd_t fd, __wasi_addr_t *addr | ||||||
| ) __attribute__((__warn_unused_result__)); | ) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t | __wasi_errno_t | ||||||
| wasi_ssp_sock_get_recv_buf_size( | wasi_ssp_sock_get_recv_buf_size( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, __wasi_size_t *size |     __wasi_fd_t fd, __wasi_size_t *size | ||||||
| ) __attribute__((__warn_unused_result__)); | ) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t | __wasi_errno_t | ||||||
| wasi_ssp_sock_get_reuse_addr( | wasi_ssp_sock_get_reuse_addr( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, uint8_t *reuse |     __wasi_fd_t fd, uint8_t *reuse | ||||||
| ) __attribute__((__warn_unused_result__)); | ) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t | __wasi_errno_t | ||||||
| wasi_ssp_sock_get_reuse_port( | wasi_ssp_sock_get_reuse_port( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, uint8_t *reuse |     __wasi_fd_t fd, uint8_t *reuse | ||||||
| ) __attribute__((__warn_unused_result__)); | ) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t | __wasi_errno_t | ||||||
| wasi_ssp_sock_get_send_buf_size( | wasi_ssp_sock_get_send_buf_size( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, __wasi_size_t *size |     __wasi_fd_t fd, __wasi_size_t *size | ||||||
| ) __attribute__((__warn_unused_result__)); | ) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t | __wasi_errno_t | ||||||
| wasi_ssp_sock_set_recv_buf_size( | wasi_ssp_sock_set_recv_buf_size( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, __wasi_size_t size |     __wasi_fd_t fd, __wasi_size_t size | ||||||
| ) __attribute__((__warn_unused_result__)); | ) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t | __wasi_errno_t | ||||||
| wasi_ssp_sock_set_reuse_addr( | wasi_ssp_sock_set_reuse_addr( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, uint8_t reuse |     __wasi_fd_t fd, uint8_t reuse | ||||||
| ) __attribute__((__warn_unused_result__)); | ) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t | __wasi_errno_t | ||||||
| wasi_ssp_sock_set_reuse_port( | wasi_ssp_sock_set_reuse_port( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, uint8_t reuse |     __wasi_fd_t fd, uint8_t reuse | ||||||
| ) __attribute__((__warn_unused_result__)); | ) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t | __wasi_errno_t | ||||||
| wasi_ssp_sock_set_send_buf_size( | wasi_ssp_sock_set_send_buf_size( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, __wasi_size_t size |     __wasi_fd_t fd, __wasi_size_t size | ||||||
| ) __attribute__((__warn_unused_result__)); | ) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t | __wasi_errno_t | ||||||
| wasi_ssp_sock_listen( | wasi_ssp_sock_listen( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t fd, __wasi_size_t backlog |     __wasi_fd_t fd, __wasi_size_t backlog | ||||||
| ) __attribute__((__warn_unused_result__)); | ) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_recv( | __wasi_errno_t wasmtime_ssp_sock_recv( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     void *buf, |     void *buf, | ||||||
|  | @ -996,6 +1045,7 @@ __wasi_errno_t wasmtime_ssp_sock_recv( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_recv) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_recv) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_recv_from( | __wasi_errno_t wasmtime_ssp_sock_recv_from( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     void *buf, |     void *buf, | ||||||
|  | @ -1006,6 +1056,7 @@ __wasi_errno_t wasmtime_ssp_sock_recv_from( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_recv_from) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_recv_from) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_send( | __wasi_errno_t wasmtime_ssp_sock_send( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     const void *buf, |     const void *buf, | ||||||
|  | @ -1014,6 +1065,7 @@ __wasi_errno_t wasmtime_ssp_sock_send( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_send) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_send) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_send_to( | __wasi_errno_t wasmtime_ssp_sock_send_to( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, struct addr_pool *addr_pool, |     struct fd_table *curfds, struct addr_pool *addr_pool, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     const void *buf, |     const void *buf, | ||||||
|  | @ -1024,53 +1076,62 @@ __wasi_errno_t wasmtime_ssp_sock_send_to( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_send_to) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_send_to) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_shutdown( | __wasi_errno_t wasmtime_ssp_sock_shutdown( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock |     __wasi_fd_t sock | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_shutdown) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_shutdown) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_set_recv_timeout( | __wasi_errno_t wasmtime_ssp_sock_set_recv_timeout( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     uint64_t timeout_us |     uint64_t timeout_us | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_set_recv_timeout) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_set_recv_timeout) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_get_recv_timeout( | __wasi_errno_t wasmtime_ssp_sock_get_recv_timeout( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     uint64_t *timeout_us |     uint64_t *timeout_us | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_get_recv_timeout) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_get_recv_timeout) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_set_send_timeout( | __wasi_errno_t wasmtime_ssp_sock_set_send_timeout( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     uint64_t timeout_us |     uint64_t timeout_us | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_set_send_timeout) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_set_send_timeout) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_get_send_timeout( | __wasi_errno_t wasmtime_ssp_sock_get_send_timeout( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     uint64_t *timeout_us |     uint64_t *timeout_us | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_get_send_timeout) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_get_send_timeout) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_set_send_buf_size( | __wasi_errno_t wasmtime_ssp_sock_set_send_buf_size( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     size_t bufsiz |     size_t bufsiz | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_set_send_buf_size) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_set_send_buf_size) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_get_send_buf_size( | __wasi_errno_t wasmtime_ssp_sock_get_send_buf_size( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     size_t *bufsiz |     size_t *bufsiz | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_get_send_buf_size) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_get_send_buf_size) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_set_recv_buf_size( | __wasi_errno_t wasmtime_ssp_sock_set_recv_buf_size( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     size_t bufsiz |     size_t bufsiz | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_set_recv_buf_size) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_set_recv_buf_size) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_get_recv_buf_size( | __wasi_errno_t wasmtime_ssp_sock_get_recv_buf_size( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     size_t *bufsiz |     size_t *bufsiz | ||||||
|  | @ -1078,42 +1139,49 @@ __wasi_errno_t wasmtime_ssp_sock_get_recv_buf_size( | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_set_keep_alive( | __wasi_errno_t wasmtime_ssp_sock_set_keep_alive( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     bool is_enabled |     bool is_enabled | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_set_keep_alive) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_set_keep_alive) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_get_keep_alive( | __wasi_errno_t wasmtime_ssp_sock_get_keep_alive( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     bool *is_enabled |     bool *is_enabled | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_get_keep_alive) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_get_keep_alive) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_set_reuse_addr( | __wasi_errno_t wasmtime_ssp_sock_set_reuse_addr( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     bool is_enabled |     bool is_enabled | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_set_reuse_addr) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_set_reuse_addr) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_get_reuse_addr( | __wasi_errno_t wasmtime_ssp_sock_get_reuse_addr( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     bool *is_enabled |     bool *is_enabled | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_get_reuse_addr) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_get_reuse_addr) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_set_reuse_port( | __wasi_errno_t wasmtime_ssp_sock_set_reuse_port( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     bool is_enabled |     bool is_enabled | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_set_reuse_port) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_set_reuse_port) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_get_reuse_port( | __wasi_errno_t wasmtime_ssp_sock_get_reuse_port( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     bool *is_enabled |     bool *is_enabled | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_get_reuse_port) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_get_reuse_port) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_set_linger( | __wasi_errno_t wasmtime_ssp_sock_set_linger( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     bool is_enabled, |     bool is_enabled, | ||||||
|  | @ -1121,83 +1189,97 @@ __wasi_errno_t wasmtime_ssp_sock_set_linger( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_set_linger) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_set_linger) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_get_linger( | __wasi_errno_t wasmtime_ssp_sock_get_linger( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, bool *is_enabled, int *linger_s |     __wasi_fd_t sock, bool *is_enabled, int *linger_s | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_get_linger) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_get_linger) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_set_broadcast( | __wasi_errno_t wasmtime_ssp_sock_set_broadcast( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     bool is_enabled |     bool is_enabled | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_set_broadcast) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_set_broadcast) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_get_broadcast( | __wasi_errno_t wasmtime_ssp_sock_get_broadcast( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     bool *is_enabled |     bool *is_enabled | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_get_broadcast) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_get_broadcast) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_set_tcp_no_delay( | __wasi_errno_t wasmtime_ssp_sock_set_tcp_no_delay( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     bool is_enabled |     bool is_enabled | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_set_tcp_no_delay) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_set_tcp_no_delay) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_get_tcp_no_delay( | __wasi_errno_t wasmtime_ssp_sock_get_tcp_no_delay( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     bool *is_enabled |     bool *is_enabled | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_get_tcp_no_delay) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_get_tcp_no_delay) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_set_tcp_quick_ack( | __wasi_errno_t wasmtime_ssp_sock_set_tcp_quick_ack( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     bool is_enabled |     bool is_enabled | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_set_tcp_quick_ack) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_set_tcp_quick_ack) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_get_tcp_quick_ack( | __wasi_errno_t wasmtime_ssp_sock_get_tcp_quick_ack( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     bool *is_enabled |     bool *is_enabled | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_get_tcp_quick_ack) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_get_tcp_quick_ack) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_set_tcp_keep_idle( | __wasi_errno_t wasmtime_ssp_sock_set_tcp_keep_idle( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     uint32_t time_s |     uint32_t time_s | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_set_tcp_keep_idle) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_set_tcp_keep_idle) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_get_tcp_keep_idle( | __wasi_errno_t wasmtime_ssp_sock_get_tcp_keep_idle( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     uint32_t *time_s |     uint32_t *time_s | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_get_tcp_keep_idle) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_get_tcp_keep_idle) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_set_tcp_keep_intvl( | __wasi_errno_t wasmtime_ssp_sock_set_tcp_keep_intvl( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     uint32_t time_s |     uint32_t time_s | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_set_tcp_keep_intvl) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_set_tcp_keep_intvl) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_get_tcp_keep_intvl( | __wasi_errno_t wasmtime_ssp_sock_get_tcp_keep_intvl( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     uint32_t *time_s |     uint32_t *time_s | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_get_tcp_keep_intvl) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_get_tcp_keep_intvl) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_set_tcp_fastopen_connect( | __wasi_errno_t wasmtime_ssp_sock_set_tcp_fastopen_connect( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     bool is_enabled |     bool is_enabled | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_set_tcp_fastopen_connect) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_set_tcp_fastopen_connect) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_get_tcp_fastopen_connect( | __wasi_errno_t wasmtime_ssp_sock_get_tcp_fastopen_connect( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     bool *is_enabled |     bool *is_enabled | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_get_tcp_fastopen_connect) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_get_tcp_fastopen_connect) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_set_ip_multicast_loop( | __wasi_errno_t wasmtime_ssp_sock_set_ip_multicast_loop( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     bool ipv6, |     bool ipv6, | ||||||
|  | @ -1205,6 +1287,7 @@ __wasi_errno_t wasmtime_ssp_sock_set_ip_multicast_loop( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_set_ip_multicast_loop) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_set_ip_multicast_loop) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_get_ip_multicast_loop( | __wasi_errno_t wasmtime_ssp_sock_get_ip_multicast_loop( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     bool ipv6, |     bool ipv6, | ||||||
|  | @ -1212,6 +1295,7 @@ __wasi_errno_t wasmtime_ssp_sock_get_ip_multicast_loop( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_get_ip_multicast_loop) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_get_ip_multicast_loop) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_set_ip_add_membership( | __wasi_errno_t wasmtime_ssp_sock_set_ip_add_membership( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     __wasi_addr_ip_t *imr_multiaddr, |     __wasi_addr_ip_t *imr_multiaddr, | ||||||
|  | @ -1219,6 +1303,7 @@ __wasi_errno_t wasmtime_ssp_sock_set_ip_add_membership( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_set_ip_add_membership) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_set_ip_add_membership) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_set_ip_drop_membership( | __wasi_errno_t wasmtime_ssp_sock_set_ip_drop_membership( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     __wasi_addr_ip_t *imr_multiaddr, |     __wasi_addr_ip_t *imr_multiaddr, | ||||||
|  | @ -1226,36 +1311,42 @@ __wasi_errno_t wasmtime_ssp_sock_set_ip_drop_membership( | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_set_ip_drop_membership) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_set_ip_drop_membership) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_set_ip_ttl( | __wasi_errno_t wasmtime_ssp_sock_set_ip_ttl( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     uint8_t ttl_s |     uint8_t ttl_s | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_set_ip_ttl) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_set_ip_ttl) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_get_ip_ttl( | __wasi_errno_t wasmtime_ssp_sock_get_ip_ttl( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     uint8_t *ttl_s |     uint8_t *ttl_s | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_get_ip_ttl) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_get_ip_ttl) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_set_ip_multicast_ttl( | __wasi_errno_t wasmtime_ssp_sock_set_ip_multicast_ttl( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     uint8_t ttl_s |     uint8_t ttl_s | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_set_ip_multicast_ttl) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_set_ip_multicast_ttl) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_get_ip_multicast_ttl( | __wasi_errno_t wasmtime_ssp_sock_get_ip_multicast_ttl( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     uint8_t *ttl_s |     uint8_t *ttl_s | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_get_ip_multicast_ttl) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_get_ip_multicast_ttl) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_set_ipv6_only( | __wasi_errno_t wasmtime_ssp_sock_set_ipv6_only( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     bool is_enabled |     bool is_enabled | ||||||
| ) WASMTIME_SSP_SYSCALL_NAME(sock_set_ipv6_only) __attribute__((__warn_unused_result__)); | ) WASMTIME_SSP_SYSCALL_NAME(sock_set_ipv6_only) __attribute__((__warn_unused_result__)); | ||||||
| 
 | 
 | ||||||
| __wasi_errno_t wasmtime_ssp_sock_get_ipv6_only( | __wasi_errno_t wasmtime_ssp_sock_get_ipv6_only( | ||||||
|  |     wasm_exec_env_t exec_env, | ||||||
|     struct fd_table *curfds, |     struct fd_table *curfds, | ||||||
|     __wasi_fd_t sock, |     __wasi_fd_t sock, | ||||||
|     bool *is_enabled |     bool *is_enabled | ||||||
|  |  | ||||||
|  | @ -0,0 +1,201 @@ | ||||||
|  | /*
 | ||||||
|  |  * Copyright (C) 2023 Midokura Japan KK.  All rights reserved. | ||||||
|  |  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #include <errno.h> | ||||||
|  | 
 | ||||||
|  | #include "ssp_config.h" | ||||||
|  | #include "blocking_op.h" | ||||||
|  | 
 | ||||||
|  | int | ||||||
|  | blocking_op_close(wasm_exec_env_t exec_env, int fd) | ||||||
|  | { | ||||||
|  |     if (!wasm_runtime_begin_blocking_op(exec_env)) { | ||||||
|  |         errno = EINTR; | ||||||
|  |         return -1; | ||||||
|  |     } | ||||||
|  |     int ret = close(fd); | ||||||
|  |     wasm_runtime_end_blocking_op(exec_env); | ||||||
|  |     return ret; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | ssize_t | ||||||
|  | blocking_op_readv(wasm_exec_env_t exec_env, int fd, const struct iovec *iov, | ||||||
|  |                   int iovcnt) | ||||||
|  | { | ||||||
|  |     if (!wasm_runtime_begin_blocking_op(exec_env)) { | ||||||
|  |         errno = EINTR; | ||||||
|  |         return -1; | ||||||
|  |     } | ||||||
|  |     ssize_t ret = readv(fd, iov, iovcnt); | ||||||
|  |     wasm_runtime_end_blocking_op(exec_env); | ||||||
|  |     return ret; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | #if CONFIG_HAS_PREADV | ||||||
|  | ssize_t | ||||||
|  | blocking_op_preadv(wasm_exec_env_t exec_env, int fd, const struct iovec *iov, | ||||||
|  |                    int iovcnt, off_t offset) | ||||||
|  | { | ||||||
|  |     if (!wasm_runtime_begin_blocking_op(exec_env)) { | ||||||
|  |         errno = EINTR; | ||||||
|  |         return -1; | ||||||
|  |     } | ||||||
|  |     ssize_t ret = preadv(fd, iov, iovcnt, offset); | ||||||
|  |     wasm_runtime_end_blocking_op(exec_env); | ||||||
|  |     return ret; | ||||||
|  | } | ||||||
|  | #else  /* CONFIG_HAS_PREADV */ | ||||||
|  | ssize_t | ||||||
|  | blocking_op_pread(wasm_exec_env_t exec_env, int fd, void *p, size_t nb, | ||||||
|  |                   off_t offset) | ||||||
|  | { | ||||||
|  |     if (!wasm_runtime_begin_blocking_op(exec_env)) { | ||||||
|  |         errno = EINTR; | ||||||
|  |         return -1; | ||||||
|  |     } | ||||||
|  |     ssize_t ret = pread(fd, p, nb, offset); | ||||||
|  |     wasm_runtime_end_blocking_op(exec_env); | ||||||
|  |     return ret; | ||||||
|  | } | ||||||
|  | #endif /* CONFIG_HAS_PREADV */ | ||||||
|  | 
 | ||||||
|  | ssize_t | ||||||
|  | blocking_op_writev(wasm_exec_env_t exec_env, int fd, const struct iovec *iov, | ||||||
|  |                    int iovcnt) | ||||||
|  | { | ||||||
|  |     if (!wasm_runtime_begin_blocking_op(exec_env)) { | ||||||
|  |         errno = EINTR; | ||||||
|  |         return -1; | ||||||
|  |     } | ||||||
|  |     ssize_t ret = writev(fd, iov, iovcnt); | ||||||
|  |     wasm_runtime_end_blocking_op(exec_env); | ||||||
|  |     return ret; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | #if CONFIG_HAS_PWRITEV | ||||||
|  | ssize_t | ||||||
|  | blocking_op_pwritev(wasm_exec_env_t exec_env, int fd, const struct iovec *iov, | ||||||
|  |                     int iovcnt, off_t offset) | ||||||
|  | { | ||||||
|  |     if (!wasm_runtime_begin_blocking_op(exec_env)) { | ||||||
|  |         errno = EINTR; | ||||||
|  |         return -1; | ||||||
|  |     } | ||||||
|  |     ssize_t ret = pwritev(fd, iov, iovcnt, offset); | ||||||
|  |     wasm_runtime_end_blocking_op(exec_env); | ||||||
|  |     return ret; | ||||||
|  | } | ||||||
|  | #else  /* CONFIG_HAS_PWRITEV */ | ||||||
|  | ssize_t | ||||||
|  | blocking_op_pwrite(wasm_exec_env_t exec_env, int fd, const void *p, size_t nb, | ||||||
|  |                    off_t offset) | ||||||
|  | { | ||||||
|  |     if (!wasm_runtime_begin_blocking_op(exec_env)) { | ||||||
|  |         errno = EINTR; | ||||||
|  |         return -1; | ||||||
|  |     } | ||||||
|  |     ssize_t ret = pwrite(fd, p, nb, offset); | ||||||
|  |     wasm_runtime_end_blocking_op(exec_env); | ||||||
|  |     return ret; | ||||||
|  | } | ||||||
|  | #endif /* CONFIG_HAS_PWRITEV */ | ||||||
|  | 
 | ||||||
|  | int | ||||||
|  | blocking_op_socket_accept(wasm_exec_env_t exec_env, bh_socket_t server_sock, | ||||||
|  |                           bh_socket_t *sockp, void *addr, | ||||||
|  |                           unsigned int *addrlenp) | ||||||
|  | { | ||||||
|  |     if (!wasm_runtime_begin_blocking_op(exec_env)) { | ||||||
|  |         errno = EINTR; | ||||||
|  |         return -1; | ||||||
|  |     } | ||||||
|  |     int ret = os_socket_accept(server_sock, sockp, addr, addrlenp); | ||||||
|  |     wasm_runtime_end_blocking_op(exec_env); | ||||||
|  |     return ret; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int | ||||||
|  | blocking_op_socket_connect(wasm_exec_env_t exec_env, bh_socket_t sock, | ||||||
|  |                            const char *addr, int port) | ||||||
|  | { | ||||||
|  |     if (!wasm_runtime_begin_blocking_op(exec_env)) { | ||||||
|  |         errno = EINTR; | ||||||
|  |         return -1; | ||||||
|  |     } | ||||||
|  |     int ret = os_socket_connect(sock, addr, port); | ||||||
|  |     wasm_runtime_end_blocking_op(exec_env); | ||||||
|  |     return ret; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int | ||||||
|  | blocking_op_socket_recv_from(wasm_exec_env_t exec_env, bh_socket_t sock, | ||||||
|  |                              void *buf, unsigned int len, int flags, | ||||||
|  |                              bh_sockaddr_t *src_addr) | ||||||
|  | { | ||||||
|  |     if (!wasm_runtime_begin_blocking_op(exec_env)) { | ||||||
|  |         errno = EINTR; | ||||||
|  |         return -1; | ||||||
|  |     } | ||||||
|  |     int ret = os_socket_recv_from(sock, buf, len, flags, src_addr); | ||||||
|  |     wasm_runtime_end_blocking_op(exec_env); | ||||||
|  |     return ret; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int | ||||||
|  | blocking_op_socket_send_to(wasm_exec_env_t exec_env, bh_socket_t sock, | ||||||
|  |                            const void *buf, unsigned int len, int flags, | ||||||
|  |                            const bh_sockaddr_t *dest_addr) | ||||||
|  | { | ||||||
|  |     if (!wasm_runtime_begin_blocking_op(exec_env)) { | ||||||
|  |         errno = EINTR; | ||||||
|  |         return -1; | ||||||
|  |     } | ||||||
|  |     int ret = os_socket_send_to(sock, buf, len, flags, dest_addr); | ||||||
|  |     wasm_runtime_end_blocking_op(exec_env); | ||||||
|  |     return ret; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int | ||||||
|  | blocking_op_socket_addr_resolve(wasm_exec_env_t exec_env, const char *host, | ||||||
|  |                                 const char *service, uint8_t *hint_is_tcp, | ||||||
|  |                                 uint8_t *hint_is_ipv4, | ||||||
|  |                                 bh_addr_info_t *addr_info, | ||||||
|  |                                 size_t addr_info_size, size_t *max_info_size) | ||||||
|  | { | ||||||
|  |     /*
 | ||||||
|  |      * Note: Unlike others, os_socket_addr_resolve() is not a simple system | ||||||
|  |      * call. It's likely backed by a complex libc function, getaddrinfo(). | ||||||
|  |      * Depending on the implementation of getaddrinfo() and underlying | ||||||
|  |      * DNS resolver, it might or might not be possible to make it return | ||||||
|  |      * with os_wakeup_blocking_op(). | ||||||
|  |      * | ||||||
|  |      * Unfortunately, many of ISC/bind based resolvers just keep going on | ||||||
|  |      * interrupted system calls. It includes macOS and glibc. | ||||||
|  |      * | ||||||
|  |      * On the other hand, NuttX as of writing this returns EAI_AGAIN | ||||||
|  |      * on EINTR. | ||||||
|  |      */ | ||||||
|  |     if (!wasm_runtime_begin_blocking_op(exec_env)) { | ||||||
|  |         errno = EINTR; | ||||||
|  |         return -1; | ||||||
|  |     } | ||||||
|  |     int ret = os_socket_addr_resolve(host, service, hint_is_tcp, hint_is_ipv4, | ||||||
|  |                                      addr_info, addr_info_size, max_info_size); | ||||||
|  |     wasm_runtime_end_blocking_op(exec_env); | ||||||
|  |     return ret; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int | ||||||
|  | blocking_op_openat(wasm_exec_env_t exec_env, int fd, const char *path, | ||||||
|  |                    int oflags, mode_t mode) | ||||||
|  | { | ||||||
|  |     if (!wasm_runtime_begin_blocking_op(exec_env)) { | ||||||
|  |         errno = EINTR; | ||||||
|  |         return -1; | ||||||
|  |     } | ||||||
|  |     int ret = openat(fd, path, oflags, mode); | ||||||
|  |     wasm_runtime_end_blocking_op(exec_env); | ||||||
|  |     return ret; | ||||||
|  | } | ||||||
|  | @ -0,0 +1,52 @@ | ||||||
|  | /*
 | ||||||
|  |  * Copyright (C) 2023 Midokura Japan KK.  All rights reserved. | ||||||
|  |  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #include "bh_platform.h" | ||||||
|  | #include "wasm_export.h" | ||||||
|  | 
 | ||||||
|  | int | ||||||
|  | blocking_op_close(wasm_exec_env_t exec_env, int fd); | ||||||
|  | ssize_t | ||||||
|  | blocking_op_readv(wasm_exec_env_t exec_env, int fd, const struct iovec *iov, | ||||||
|  |                   int iovcnt); | ||||||
|  | ssize_t | ||||||
|  | blocking_op_preadv(wasm_exec_env_t exec_env, int fd, const struct iovec *iov, | ||||||
|  |                    int iovcnt, off_t offset); | ||||||
|  | ssize_t | ||||||
|  | blocking_op_pread(wasm_exec_env_t exec_env, int fd, void *p, size_t nb, | ||||||
|  |                   off_t offset); | ||||||
|  | ssize_t | ||||||
|  | blocking_op_writev(wasm_exec_env_t exec_env, int fd, const struct iovec *iov, | ||||||
|  |                    int iovcnt); | ||||||
|  | ssize_t | ||||||
|  | blocking_op_pwritev(wasm_exec_env_t exec_env, int fd, const struct iovec *iov, | ||||||
|  |                     int iovcnt, off_t offset); | ||||||
|  | ssize_t | ||||||
|  | blocking_op_pwrite(wasm_exec_env_t exec_env, int fd, const void *p, size_t nb, | ||||||
|  |                    off_t offset); | ||||||
|  | int | ||||||
|  | blocking_op_socket_accept(wasm_exec_env_t exec_env, bh_socket_t server_sock, | ||||||
|  |                           bh_socket_t *sockp, void *addr, | ||||||
|  |                           unsigned int *addrlenp); | ||||||
|  | int | ||||||
|  | blocking_op_socket_connect(wasm_exec_env_t exec_env, bh_socket_t sock, | ||||||
|  |                            const char *addr, int port); | ||||||
|  | int | ||||||
|  | blocking_op_socket_recv_from(wasm_exec_env_t exec_env, bh_socket_t sock, | ||||||
|  |                              void *buf, unsigned int len, int flags, | ||||||
|  |                              bh_sockaddr_t *src_addr); | ||||||
|  | int | ||||||
|  | blocking_op_socket_send_to(wasm_exec_env_t exec_env, bh_socket_t sock, | ||||||
|  |                            const void *buf, unsigned int len, int flags, | ||||||
|  |                            const bh_sockaddr_t *dest_addr); | ||||||
|  | int | ||||||
|  | blocking_op_socket_addr_resolve(wasm_exec_env_t exec_env, const char *host, | ||||||
|  |                                 const char *service, uint8_t *hint_is_tcp, | ||||||
|  |                                 uint8_t *hint_is_ipv4, | ||||||
|  |                                 bh_addr_info_t *addr_info, | ||||||
|  |                                 size_t addr_info_size, size_t *max_info_size); | ||||||
|  | int | ||||||
|  | blocking_op_openat(wasm_exec_env_t exec_env, int fd, const char *path, | ||||||
|  |                    int oflags, mode_t mode); | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							|  | @ -1059,6 +1059,10 @@ set_thread_cancel_flags(WASMExecEnv *exec_env) | ||||||
|                                 WASM_SUSPEND_FLAG_TERMINATE); |                                 WASM_SUSPEND_FLAG_TERMINATE); | ||||||
| 
 | 
 | ||||||
|     os_mutex_unlock(&exec_env->wait_lock); |     os_mutex_unlock(&exec_env->wait_lock); | ||||||
|  | 
 | ||||||
|  | #ifdef OS_ENABLE_WAKEUP_BLOCKING_OP | ||||||
|  |     wasm_runtime_interrupt_blocking_op(exec_env); | ||||||
|  | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static void | static void | ||||||
|  |  | ||||||
							
								
								
									
										69
									
								
								core/shared/platform/common/posix/posix_blocking_op.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								core/shared/platform/common/posix/posix_blocking_op.c
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,69 @@ | ||||||
|  | /*
 | ||||||
|  |  * Copyright (C) 2023 Midokura Japan KK.  All rights reserved. | ||||||
|  |  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #include "platform_api_extension.h" | ||||||
|  | 
 | ||||||
|  | #ifdef OS_ENABLE_WAKEUP_BLOCKING_OP | ||||||
|  | 
 | ||||||
|  | static bool g_blocking_op_inited = false; | ||||||
|  | static int g_blocking_op_signo = SIGUSR1; | ||||||
|  | static sigset_t g_blocking_op_sigmask; | ||||||
|  | 
 | ||||||
|  | static void | ||||||
|  | blocking_op_sighandler(int signo) | ||||||
|  | { | ||||||
|  |     /* nothing */ | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void | ||||||
|  | os_set_signal_number_for_blocking_op(int signo) | ||||||
|  | { | ||||||
|  |     g_blocking_op_signo = signo; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int | ||||||
|  | os_blocking_op_init() | ||||||
|  | { | ||||||
|  |     if (g_blocking_op_inited) { | ||||||
|  |         return BHT_OK; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     sigemptyset(&g_blocking_op_sigmask); | ||||||
|  |     sigaddset(&g_blocking_op_sigmask, g_blocking_op_signo); | ||||||
|  | 
 | ||||||
|  |     struct sigaction sa; | ||||||
|  |     sigemptyset(&sa.sa_mask); | ||||||
|  |     sa.sa_flags = 0; | ||||||
|  |     sa.sa_handler = blocking_op_sighandler; | ||||||
|  |     if (sigaction(g_blocking_op_signo, &sa, NULL)) { | ||||||
|  |         return BHT_ERROR; | ||||||
|  |     } | ||||||
|  |     g_blocking_op_inited = true; | ||||||
|  |     return BHT_OK; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void | ||||||
|  | os_begin_blocking_op() | ||||||
|  | { | ||||||
|  |     pthread_sigmask(SIG_UNBLOCK, &g_blocking_op_sigmask, NULL); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void | ||||||
|  | os_end_blocking_op() | ||||||
|  | { | ||||||
|  |     pthread_sigmask(SIG_BLOCK, &g_blocking_op_sigmask, NULL); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int | ||||||
|  | os_wakeup_blocking_op(korp_tid tid) | ||||||
|  | { | ||||||
|  |     int ret = pthread_kill(tid, g_blocking_op_signo); | ||||||
|  |     if (ret != 0) { | ||||||
|  |         return BHT_ERROR; | ||||||
|  |     } | ||||||
|  |     return BHT_OK; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | #endif /* OS_ENABLE_WAKEUP_BLOCKING_OP */ | ||||||
|  | @ -39,6 +39,9 @@ os_thread_wrapper(void *arg) | ||||||
| #ifdef OS_ENABLE_HW_BOUND_CHECK | #ifdef OS_ENABLE_HW_BOUND_CHECK | ||||||
|     if (os_thread_signal_init(handler) != 0) |     if (os_thread_signal_init(handler) != 0) | ||||||
|         return NULL; |         return NULL; | ||||||
|  | #endif | ||||||
|  | #ifdef OS_ENABLE_WAKEUP_BLOCKING_OP | ||||||
|  |     os_end_blocking_op(); | ||||||
| #endif | #endif | ||||||
|     start_func(thread_arg); |     start_func(thread_arg); | ||||||
| #ifdef OS_ENABLE_HW_BOUND_CHECK | #ifdef OS_ENABLE_HW_BOUND_CHECK | ||||||
|  |  | ||||||
|  | @ -102,6 +102,12 @@ os_sigreturn(); | ||||||
| #endif /* end of BUILD_TARGET_X86_64/AMD_64/AARCH64/RISCV64 */ | #endif /* end of BUILD_TARGET_X86_64/AMD_64/AARCH64/RISCV64 */ | ||||||
| #endif /* end of WASM_DISABLE_HW_BOUND_CHECK */ | #endif /* end of WASM_DISABLE_HW_BOUND_CHECK */ | ||||||
| 
 | 
 | ||||||
|  | #if WASM_DISABLE_WAKEUP_BLOCKING_OP != 0 | ||||||
|  | #define OS_ENABLE_WAKEUP_BLOCKING_OP | ||||||
|  | #endif | ||||||
|  | void | ||||||
|  | os_set_signal_number_for_blocking_op(int signo); | ||||||
|  | 
 | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | @ -101,6 +101,12 @@ os_sigreturn(); | ||||||
| #endif /* end of BUILD_TARGET_X86_64/AMD_64/AARCH64/RISCV64 */ | #endif /* end of BUILD_TARGET_X86_64/AMD_64/AARCH64/RISCV64 */ | ||||||
| #endif /* end of WASM_DISABLE_HW_BOUND_CHECK */ | #endif /* end of WASM_DISABLE_HW_BOUND_CHECK */ | ||||||
| 
 | 
 | ||||||
|  | #if WASM_DISABLE_WAKEUP_BLOCKING_OP != 0 | ||||||
|  | #define OS_ENABLE_WAKEUP_BLOCKING_OP | ||||||
|  | #endif | ||||||
|  | void | ||||||
|  | os_set_signal_number_for_blocking_op(int signo); | ||||||
|  | 
 | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | @ -323,6 +323,34 @@ os_sem_getvalue(korp_sem *sem, int *sval); | ||||||
| int | int | ||||||
| os_sem_unlink(const char *name); | os_sem_unlink(const char *name); | ||||||
| 
 | 
 | ||||||
|  | /**
 | ||||||
|  |  * Initialize process-global state for os_wakeup_blocking_op. | ||||||
|  |  */ | ||||||
|  | int | ||||||
|  | os_blocking_op_init(); | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * Start accepting os_wakeup_blocking_op requests for the calling thread. | ||||||
|  |  */ | ||||||
|  | void | ||||||
|  | os_begin_blocking_op(); | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * Stop accepting os_wakeup_blocking_op requests for the calling thread. | ||||||
|  |  */ | ||||||
|  | void | ||||||
|  | os_end_blocking_op(); | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * Wake up the specified thread. | ||||||
|  |  * | ||||||
|  |  * For example, on posix-like platforms, this can be implemented by | ||||||
|  |  * sending a signal (w/o SA_RESTART) which interrupts a blocking | ||||||
|  |  * system call. | ||||||
|  |  */ | ||||||
|  | int | ||||||
|  | os_wakeup_blocking_op(korp_tid tid); | ||||||
|  | 
 | ||||||
| /****************************************************
 | /****************************************************
 | ||||||
|  *                     Section 2                    * |  *                     Section 2                    * | ||||||
|  *                   Socket support                 * |  *                   Socket support                 * | ||||||
|  |  | ||||||
|  | @ -115,6 +115,12 @@ os_sigreturn(); | ||||||
| #endif /* end of BUILD_TARGET_X86_64/AMD_64/AARCH64/RISCV64 */ | #endif /* end of BUILD_TARGET_X86_64/AMD_64/AARCH64/RISCV64 */ | ||||||
| #endif /* end of WASM_DISABLE_HW_BOUND_CHECK */ | #endif /* end of WASM_DISABLE_HW_BOUND_CHECK */ | ||||||
| 
 | 
 | ||||||
|  | #if WASM_DISABLE_WAKEUP_BLOCKING_OP != 0 | ||||||
|  | #define OS_ENABLE_WAKEUP_BLOCKING_OP | ||||||
|  | #endif | ||||||
|  | void | ||||||
|  | os_set_signal_number_for_blocking_op(int signo); | ||||||
|  | 
 | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | @ -123,6 +123,12 @@ utimensat(int fd, const char *path, const struct timespec ts[2], int flag); | ||||||
| DIR * | DIR * | ||||||
| fdopendir(int fd); | fdopendir(int fd); | ||||||
| 
 | 
 | ||||||
|  | #if WASM_DISABLE_WAKEUP_BLOCKING_OP != 0 | ||||||
|  | #define OS_ENABLE_WAKEUP_BLOCKING_OP | ||||||
|  | #endif | ||||||
|  | void | ||||||
|  | os_set_signal_number_for_blocking_op(int signo); | ||||||
|  | 
 | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | @ -109,6 +109,10 @@ cmake -DWAMR_BUILD_PLATFORM=linux -DWAMR_BUILD_TARGET=ARM | ||||||
| - **WAMR_DISABLE_STACK_HW_BOUND_CHECK**=1/0, default to enable if not set and supported by platform, same as `WAMR_DISABLE_HW_BOUND_CHECK`. | - **WAMR_DISABLE_STACK_HW_BOUND_CHECK**=1/0, default to enable if not set and supported by platform, same as `WAMR_DISABLE_HW_BOUND_CHECK`. | ||||||
| > Note: When boundary check with hardware trap is disabled, or `WAMR_DISABLE_HW_BOUND_CHECK` is set to 1, the native stack boundary check with hardware trap will be disabled too, no matter what value is set to `WAMR_DISABLE_STACK_HW_BOUND_CHECK`. And when boundary check with hardware trap is enabled, the status of this feature is set according to the value of `WAMR_DISABLE_STACK_HW_BOUND_CHECK`. | > Note: When boundary check with hardware trap is disabled, or `WAMR_DISABLE_HW_BOUND_CHECK` is set to 1, the native stack boundary check with hardware trap will be disabled too, no matter what value is set to `WAMR_DISABLE_STACK_HW_BOUND_CHECK`. And when boundary check with hardware trap is enabled, the status of this feature is set according to the value of `WAMR_DISABLE_STACK_HW_BOUND_CHECK`. | ||||||
| 
 | 
 | ||||||
|  | #### **Disable async wakeup of blocking operation** | ||||||
|  | - **WAMR_DISABLE_WAKEUP_BLOCKING_OP**=1/0, default to enable if supported by the platform | ||||||
|  | > Note: The feature helps async termination of blocking threads. If you disable it, the runtime can wait for termination of blocking threads possibly forever. | ||||||
|  | 
 | ||||||
| #### **Enable tail call feature** | #### **Enable tail call feature** | ||||||
| - **WAMR_BUILD_TAIL_CALL**=1/0, default to disable if not set | - **WAMR_BUILD_TAIL_CALL**=1/0, default to disable if not set | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -246,6 +246,7 @@ ifeq ($(CONFIG_INTERPRETERS_WAMR_LIBC_WASI),y) | ||||||
| CFLAGS += -DWASM_ENABLE_LIBC_WASI=1 | CFLAGS += -DWASM_ENABLE_LIBC_WASI=1 | ||||||
| CFLAGS += -I$(IWASM_ROOT)/libraries/libc-wasi/sandboxed-system-primitives/src | CFLAGS += -I$(IWASM_ROOT)/libraries/libc-wasi/sandboxed-system-primitives/src | ||||||
| CFLAGS += -I$(IWASM_ROOT)/libraries/libc-wasi/sandboxed-system-primitives/include | CFLAGS += -I$(IWASM_ROOT)/libraries/libc-wasi/sandboxed-system-primitives/include | ||||||
|  | CSRCS += blocking_op.c | ||||||
| CSRCS += posix_socket.c | CSRCS += posix_socket.c | ||||||
| CSRCS += libc_wasi_wrapper.c | CSRCS += libc_wasi_wrapper.c | ||||||
| VPATH += $(IWASM_ROOT)/libraries/libc-wasi | VPATH += $(IWASM_ROOT)/libraries/libc-wasi | ||||||
|  | @ -309,6 +310,9 @@ CFLAGS += -DWASM_DISABLE_HW_BOUND_CHECK=0 | ||||||
| CFLAGS += -DWASM_DISABLE_STACK_HW_BOUND_CHECK=0 | CFLAGS += -DWASM_DISABLE_STACK_HW_BOUND_CHECK=0 | ||||||
| endif | endif | ||||||
| 
 | 
 | ||||||
|  | # REVISIT: is this worth to have a Kconfig?
 | ||||||
|  | CFLAGS += -DWASM_DISABLE_WAKEUP_BLOCKING_OP=0 | ||||||
|  | 
 | ||||||
| ifeq ($(CONFIG_INTERPRETERS_WAMR_CUSTOM_NAME_SECTIONS),y) | ifeq ($(CONFIG_INTERPRETERS_WAMR_CUSTOM_NAME_SECTIONS),y) | ||||||
| CFLAGS += -DWASM_ENABLE_CUSTOM_NAME_SECTION=1 | CFLAGS += -DWASM_ENABLE_CUSTOM_NAME_SECTION=1 | ||||||
| else | else | ||||||
|  | @ -354,8 +358,10 @@ CFLAGS += -I$(IWASM_ROOT)/interpreter | ||||||
| endif | endif | ||||||
| 
 | 
 | ||||||
| CSRCS += nuttx_platform.c \
 | CSRCS += nuttx_platform.c \
 | ||||||
|  |          posix_blocking_op.c \
 | ||||||
|          posix_thread.c \
 |          posix_thread.c \
 | ||||||
|          posix_time.c \
 |          posix_time.c \
 | ||||||
|  |          posix_sleep.c \
 | ||||||
|          mem_alloc.c \
 |          mem_alloc.c \
 | ||||||
|          ems_kfc.c \
 |          ems_kfc.c \
 | ||||||
|          ems_alloc.c \
 |          ems_alloc.c \
 | ||||||
|  | @ -370,6 +376,7 @@ CSRCS += nuttx_platform.c \ | ||||||
|          bh_read_file.c \
 |          bh_read_file.c \
 | ||||||
|          runtime_timer.c \
 |          runtime_timer.c \
 | ||||||
|          wasm_application.c \
 |          wasm_application.c \
 | ||||||
|  |          wasm_blocking_op.c \
 | ||||||
|          wasm_runtime_common.c \
 |          wasm_runtime_common.c \
 | ||||||
|          wasm_native.c \
 |          wasm_native.c \
 | ||||||
|          wasm_exec_env.c \
 |          wasm_exec_env.c \
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 YAMAMOTO Takashi
						YAMAMOTO Takashi