[libcxx-commits] [PATCH] D61336: [WebAssembly] WASI support for libcxx

Dan Gohman via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 30 15:37:38 PDT 2019


sunfish marked an inline comment as done.
sunfish added inline comments.


================
Comment at: src/random.cpp:28
 #if defined(_LIBCPP_USING_GETENTROPY)
+#if defined(__APPLE__)
 #include <sys/random.h>
----------------
ldionne wrote:
> If Fuchsia also needs this change, how come is the code working right now? I'm trying to understand the reason for this change.
> 
Some systems declare `getentropy` in both `sys/random.h` and `unistd.h` (eg. GLIBC), some just in `unistd.h` (eg. musl), and some just in `sys/random.h` (eg. Darwin). Perhaps Fuchsia is in the last category -- just in `sys/random.h`.

It looks like a better solution here is to just make WASI libc declare `getentropy` in its `sys/random.h`, so that we don't need to change the code here. I'll update the patch here accordingly.


Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61336/new/

https://reviews.llvm.org/D61336





More information about the libcxx-commits mailing list