jwakely added subscribers: fweimer, dalias. jwakely added inline comments.
================ Comment at: libcxx/trunk/src/random.cpp:29 +#if defined(_LIBCPP_USING_GETENTROPY) +#include <sys/random.h> +#elif defined(_LIBCPP_USING_DEV_RANDOM) ---------------- mcgrathr wrote: > jwakely wrote: > > jwakely wrote: > > > musl only declares `getentropy` in `<unistd.h>` not `<sys/random.h>`. > > > Glibc declares it in both. Should `<unistd.h>` also be included when > > > `_LIBCPP_USING_GETENTROPY` is defined, so it can work more portably? > > I suppose it doesn't really matter, since `_LIBCPP_USING_GETENTROPY` is > > currently only defined for fuchsia and wasi, which both declare > > `getentropy` in `<sys/random.h>`. > FWIW, if there is an emerging norm to declare getentropy in <unistd.h> then > Fuchsia's libc can add it to our <unistd.h> and there's no real problem > relying on that in libc++ sources within about a week of when we land that > change in Fuchsia's trunk. > @fweimer added it to glibc's unistd.h for compatibility with existing BSD code: https://sourceware.org/bugzilla/show_bug.cgi?id=17252#c9 Maybe @dalias can confirm whether musl did it for the same reason? Does it make sense to "standardize" on declaring `getentropy` in `unistd.h`? Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D40319/new/ https://reviews.llvm.org/D40319 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits