From e1934f2478e51deb8df7a23d9280d971a701cb3b Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Wed, 27 Apr 2022 18:49:06 +0900 Subject: [PATCH] sandboxed-system-primitives: Use d_ino=0 for NuttX (#1128) NuttX doesn't have d_ino. --- .../libc-wasi/sandboxed-system-primitives/src/posix.c | 4 ++++ .../libc-wasi/sandboxed-system-primitives/src/ssp_config.h | 6 ++++++ 2 files changed, 10 insertions(+) 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 b802d6c0..1e201aa2 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 @@ -1996,7 +1996,11 @@ wasmtime_ssp_fd_readdir( size_t namlen = strlen(de->d_name); __wasi_dirent_t cde = { .d_next = fo->directory.offset, +#if CONFIG_HAS_D_INO .d_ino = de->d_ino, +#else + .d_ino = 0, +#endif .d_namlen = (uint32)namlen, }; switch (de->d_type) { diff --git a/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/ssp_config.h b/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/ssp_config.h index a64d90f3..5ffcb6b3 100644 --- a/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/ssp_config.h +++ b/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/ssp_config.h @@ -105,4 +105,10 @@ #define CONFIG_HAS_STD_ATOMIC 0 #endif +#if !defined(__NuttX__) +#define CONFIG_HAS_D_INO 1 +#else +#define CONFIG_HAS_D_INO 0 +#endif + #endif