Skip to content

Commit 72872cb

Browse files
authored
Fix mac build of libc_emcc_wrapper.c (#3836)
1 parent e0027f3 commit 72872cb

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

core/iwasm/libraries/libc-emcc/libc_emcc_wrapper.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,21 @@ statbuf_native2app(const struct stat *statbuf_native,
168168
statbuf_app->st_blksize = (unsigned)statbuf_native->st_blksize;
169169
statbuf_app->st_blocks = (unsigned)statbuf_native->st_blocks;
170170
statbuf_app->st_ino = (int64)statbuf_native->st_ino;
171+
#if defined(__APPLE__)
172+
statbuf_app->st_atim.tv_sec = (int)statbuf_native->st_atimespec.tv_sec;
173+
statbuf_app->st_atim.tv_nsec = (int)statbuf_native->st_atimespec.tv_nsec;
174+
statbuf_app->st_mtim.tv_sec = (int)statbuf_native->st_mtimespec.tv_sec;
175+
statbuf_app->st_mtim.tv_nsec = (int)statbuf_native->st_mtimespec.tv_nsec;
176+
statbuf_app->st_ctim.tv_sec = (int)statbuf_native->st_ctimespec.tv_sec;
177+
statbuf_app->st_ctim.tv_nsec = (int)statbuf_native->st_ctimespec.tv_nsec;
178+
#else
171179
statbuf_app->st_atim.tv_sec = (int)statbuf_native->st_atim.tv_sec;
172180
statbuf_app->st_atim.tv_nsec = (int)statbuf_native->st_atim.tv_nsec;
173181
statbuf_app->st_mtim.tv_sec = (int)statbuf_native->st_mtim.tv_sec;
174182
statbuf_app->st_mtim.tv_nsec = (int)statbuf_native->st_mtim.tv_nsec;
175183
statbuf_app->st_ctim.tv_sec = (int)statbuf_native->st_ctim.tv_sec;
176184
statbuf_app->st_ctim.tv_nsec = (int)statbuf_native->st_ctim.tv_nsec;
185+
#endif
177186
}
178187

179188
static int
@@ -261,7 +270,8 @@ getentropy_wrapper(wasm_exec_env_t exec_env, void *buffer, uint32 length)
261270
{
262271
if (buffer == NULL)
263272
return -1;
264-
#if defined(_DEFAULT_SOURCE) || defined(BH_PLATFORM_LINUX_SGX)
273+
#if defined(_DEFAULT_SOURCE) || defined(BH_PLATFORM_LINUX_SGX) \
274+
|| defined(__APPLE__)
265275
return getentropy(buffer, length);
266276
#else
267277
return syscall(SYS_getrandom, buffer, length, 0);

0 commit comments

Comments
 (0)