From 7537d8680476a779485fb4d64ed589c997ff58e7 Mon Sep 17 00:00:00 2001 From: Krisztian Szilvasi <34309983+kr-t@users.noreply.github.com> Date: Mon, 6 Oct 2025 12:25:40 +0200 Subject: [PATCH 1/2] Remove warnings relevant to Zephyr platform Signed-off-by: Krisztian Szilvasi <34309983+kr-t@users.noreply.github.com> --- .../libc-wasi/sandboxed-system-primitives/src/posix.c | 2 +- core/shared/platform/zephyr/platform_internal.h | 2 ++ core/shared/platform/zephyr/zephyr_file.c | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c b/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c index 3d90811bca..eea4dc32f8 100644 --- a/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c +++ b/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c @@ -2213,7 +2213,7 @@ wasmtime_ssp_poll_oneoff(wasm_exec_env_t exec_env, struct fd_table *curfds, // Temporary workaround (see PR#4377) #ifdef BH_PLATFORM_ZEPHYR - os_file_handle tfd = fos[i]->file_handle->fd; + int tfd = fos[i]->file_handle->fd; #else os_file_handle tfd = fos[i]->file_handle; #endif diff --git a/core/shared/platform/zephyr/platform_internal.h b/core/shared/platform/zephyr/platform_internal.h index d5f0c80d81..134b5c2b5f 100644 --- a/core/shared/platform/zephyr/platform_internal.h +++ b/core/shared/platform/zephyr/platform_internal.h @@ -290,7 +290,9 @@ typedef struct timespec os_timespec; #define CLOCK_REALTIME 1 #endif +#ifndef CLOCK_MONOTONIC #define CLOCK_MONOTONIC 4 +#endif static inline int os_sched_yield(void) diff --git a/core/shared/platform/zephyr/zephyr_file.c b/core/shared/platform/zephyr/zephyr_file.c index 1f48bc010c..79b6756e3f 100644 --- a/core/shared/platform/zephyr/zephyr_file.c +++ b/core/shared/platform/zephyr/zephyr_file.c @@ -6,6 +6,7 @@ #include "platform_api_vmcore.h" #include "platform_api_extension.h" #include "libc_errno.h" +#include "bh_common.h" #include #include @@ -1195,4 +1196,4 @@ bool os_is_stderr_handle(os_file_handle handle) { return (handle == (os_file_handle)stderr); -} \ No newline at end of file +} From bdfd724a2b6d0c682c9498056681574b672f84d5 Mon Sep 17 00:00:00 2001 From: Krisztian Szilvasi <34309983+kr-t@users.noreply.github.com> Date: Mon, 6 Oct 2025 12:49:14 +0200 Subject: [PATCH 2/2] Revert changing os_file_handle to int on Zephyr Signed-off-by: Krisztian Szilvasi <34309983+kr-t@users.noreply.github.com> --- .../libraries/libc-wasi/sandboxed-system-primitives/src/posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c b/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c index eea4dc32f8..3d90811bca 100644 --- a/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c +++ b/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c @@ -2213,7 +2213,7 @@ wasmtime_ssp_poll_oneoff(wasm_exec_env_t exec_env, struct fd_table *curfds, // Temporary workaround (see PR#4377) #ifdef BH_PLATFORM_ZEPHYR - int tfd = fos[i]->file_handle->fd; + os_file_handle tfd = fos[i]->file_handle->fd; #else os_file_handle tfd = fos[i]->file_handle; #endif