[PATCH] libc++: Add support for arc4random() to random_device.

Ed Schouten ed at 80386.nl
Sat Mar 7 00:12:09 PST 2015


Hi jfb, majnemer,

Nuxi CloudABI (https://github.com/NuxiNL/cloudlibc) does not allow processes to access the global filesystem namespace. This breaks random_device, as it attempts to use /dev/{u,}random. This change adds support for arc4random(), which is present on CloudABI. In my opinion it would also make sense to use arc4random() on other operating systems, such as *BSD and Mac OS X, but I'd rather leave that to the maintainers of the respective platforms.

This change also attempts to make some cleanups to the code. It adds a single #define for every random interface, instead of testing against operating systems explicitly.

http://reviews.llvm.org/D8134

Files:
  include/__config
  include/random
  src/random.cpp
  test/std/numerics/rand/rand.device/ctor.pass.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8134.21416.patch
Type: text/x-patch
Size: 6133 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150307/a6a0c603/attachment.bin>


More information about the cfe-commits mailing list