Skip to content

Commit 3a2b078

Browse files
committed
WIP zephyr_file posix fixes
1 parent 5036ce7 commit 3a2b078

File tree

3 files changed

+316
-45
lines changed

3 files changed

+316
-45
lines changed

core/shared/platform/zephyr/platform_internal.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353
#include <zephyr/net/socket.h>
5454
#endif /* end of KERNEL_VERSION_NUMBER < 0x030200 */
5555

56+
// #include <zephyr/fs/fs_interface.h>
57+
5658
#ifdef CONFIG_USERSPACE
5759
#include <zephyr/sys/mutex.h>
5860
#include <zephyr/sys/sem.h>
@@ -262,6 +264,7 @@ typedef struct zephyr_fs_desc {
262264
typedef struct zephyr_handle {
263265
int fd;
264266
bool is_sock;
267+
bool is_posix_fd;
265268
} zephyr_handle;
266269

267270
typedef struct zephyr_handle *os_file_handle;
@@ -290,7 +293,9 @@ typedef struct timespec os_timespec;
290293
#define CLOCK_REALTIME 1
291294
#endif
292295

296+
#ifndef CLOCK_MONOTONIC
293297
#define CLOCK_MONOTONIC 4
298+
#endif
294299

295300
static inline int
296301
os_sched_yield(void)

core/shared/platform/zephyr/shared_platform.cmake

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,19 @@ if(${CONFIG_MINIMAL_LIBC})
1515
set (source_all ${source_all} ${PLATFORM_COMMON_MATH_SOURCE})
1616
endif()
1717

18+
# list(APPEND source_all ${PLATFORM_SHARED_DIR}/../common/posix/posix_file.c)
19+
list(APPEND source_all ${PLATFORM_SHARED_DIR}/../common/posix/posix_convert_stat.c)
20+
21+
# list(REMOVE_ITEM source_all ${PLATFORM_SHARED_DIR}/zephyr_file.c)
22+
23+
1824
if (NOT WAMR_BUILD_LIBC_WASI EQUAL 1)
1925
list(REMOVE_ITEM source_all ${PLATFORM_SHARED_DIR}/zephyr_socket.c)
2026
list(REMOVE_ITEM source_all ${PLATFORM_SHARED_DIR}/zephyr_file.c)
2127
list(REMOVE_ITEM source_all ${PLATFORM_SHARED_DIR}/zephyr_clock.c)
2228
else()
23-
include (${CMAKE_CURRENT_LIST_DIR}/../common/libc-util/platform_common_libc_util.cmake)
24-
set(source_all ${source_all} ${PLATFORM_COMMON_LIBC_UTIL_SOURCE})
29+
include (${CMAKE_CURRENT_LIST_DIR}/../common/libc-util/platform_common_libc_util.cmake)
30+
set(source_all ${source_all} ${PLATFORM_COMMON_LIBC_UTIL_SOURCE})
2531
endif ()
2632

2733
set (PLATFORM_SHARED_SOURCE ${source_all})

0 commit comments

Comments
 (0)