Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion core/iwasm/libraries/libc-emcc/libc_emcc_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,21 @@ statbuf_native2app(const struct stat *statbuf_native,
statbuf_app->st_blksize = (unsigned)statbuf_native->st_blksize;
statbuf_app->st_blocks = (unsigned)statbuf_native->st_blocks;
statbuf_app->st_ino = (int64)statbuf_native->st_ino;
#if defined(__APPLE__)
statbuf_app->st_atim.tv_sec = (int)statbuf_native->st_atimespec.tv_sec;
statbuf_app->st_atim.tv_nsec = (int)statbuf_native->st_atimespec.tv_nsec;
statbuf_app->st_mtim.tv_sec = (int)statbuf_native->st_mtimespec.tv_sec;
statbuf_app->st_mtim.tv_nsec = (int)statbuf_native->st_mtimespec.tv_nsec;
statbuf_app->st_ctim.tv_sec = (int)statbuf_native->st_ctimespec.tv_sec;
statbuf_app->st_ctim.tv_nsec = (int)statbuf_native->st_ctimespec.tv_nsec;
#else
statbuf_app->st_atim.tv_sec = (int)statbuf_native->st_atim.tv_sec;
statbuf_app->st_atim.tv_nsec = (int)statbuf_native->st_atim.tv_nsec;
statbuf_app->st_mtim.tv_sec = (int)statbuf_native->st_mtim.tv_sec;
statbuf_app->st_mtim.tv_nsec = (int)statbuf_native->st_mtim.tv_nsec;
statbuf_app->st_ctim.tv_sec = (int)statbuf_native->st_ctim.tv_sec;
statbuf_app->st_ctim.tv_nsec = (int)statbuf_native->st_ctim.tv_nsec;
#endif
}

static int
Expand Down Expand Up @@ -261,7 +270,8 @@ getentropy_wrapper(wasm_exec_env_t exec_env, void *buffer, uint32 length)
{
if (buffer == NULL)
return -1;
#if defined(_DEFAULT_SOURCE) || defined(BH_PLATFORM_LINUX_SGX)
#if defined(_DEFAULT_SOURCE) || defined(BH_PLATFORM_LINUX_SGX) \
|| defined(__APPLE__)
return getentropy(buffer, length);
#else
return syscall(SYS_getrandom, buffer, length, 0);
Expand Down