History log of /external/libcxx/src/random.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
04674ef99be8ef54a31b339a1113420345fcdc10 31-Dec-2016 Saleem Abdulrasool <compnerd@compnerd.org> random: include __config before building

We need to include __config to ensure that we know what random
implementation is being used. Fixes compilation for Windows.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290775 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/random.cpp
63e70b67eb93f78eae8122ce31443d394dcbd196 10-Mar-2015 Ed Schouten <ed@80386.nl> Add support for arc4random() to random_device.

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. Switching to
arc4random() does change the ABI.

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.

As discussed, also validate the token argument to be equal to
"/dev/urandom" on all systems that only provide pseudo-random numbers.
This should cause little to no breakage, as "/dev/urandom" is also the
default argument value.

Reviewed by: jfb
Differential Revision: http://reviews.llvm.org/D8134


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@231764 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/random.cpp
aaf0b548fbfc92506708abc6a38d88ff49bc8ce3 04-Feb-2015 JF Bastien <jfb@google.com> libc++: remove unused variable in random_device::operator()()

Reviewers: jvoung

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D7416

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@228183 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/random.cpp
2bd5ffd330036d753b5e43201fc6fa76214b0e3e 01-Dec-2014 JF Bastien <jfb@google.com> libc++: add NaCl and PNaCl support for std::random_device

Summary:
The NaCl sandbox doesn't allow opening files under /dev, but it offers an API which provides the same capabilities. This is the same random device emulation that nacl_io performs for POSIX support, but nacl_io is an optional library so libc++ can't assume that device emulation will be performed. Note that NaCl only supports /dev/urandom, not /dev/random.

This patch also cleans up some of the preprocessor #endif, and fixes the test for Win32 (it accepts any token, and would therefore never throw regardless of the token provided).

Test Plan: ninja check-libcxx

Reviewers: dschuff, mclow.lists, danalbert

Subscribers: jfb, cfe-commits

Differential Revision: http://reviews.llvm.org/D6442

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223068 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/random.cpp
4d9f97b40ba41e0409e0d0047948847907ed79ec 03-Jun-2014 David Majnemer <david.majnemer@gmail.com> [libc++] Don't return uninitialized data from random_device::operator()

Make sure we appropriately retry calls to read if the return result is
less than what we asked for.

Additionally, check and handle IO errors: EINTR results in the read
operation getting restarted; other errors turn into exceptions.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@210061 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/random.cpp
8db32cc2ac3ee94eaec6a6f7d9d285c512ce8eb2 03-Jun-2014 David Majnemer <david.majnemer@gmail.com> [libc++] random_device fails if open returns zero

random_device::random_device(const string&) wrongly assumes that open
can only validly return a file descriptor greater than zero.

This results in random_device believing that it didn't successfully open
the device causing it to throw in it's constructor, this ends up leaking
a file descriptor.

The fix is simple, don't error on file descriptors which are zero.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@210060 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/random.cpp
81241a944099014cc56929a99355cede91ada83c 18-Nov-2013 Yaron Keren <yaron.keren@gmail.com> G M suggestion: conditionally include files on _WIN32.



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@195045 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/random.cpp
b8dd5caf5a77c1840464fb4253a70e306371012c 09-Oct-2013 Marshall Clow <mclow.lists@gmail.com> patch by Yaron: Uses rand_s() from stdlib.h (when building for Windows)

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@192325 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/random.cpp
c83960a9e45fb5f787404b2090e0b95bb35bf0ff 20-Jul-2012 Howard Hinnant <hhinnant@apple.com> noexcept applied to <random>.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160579 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/random.cpp
997e4541395abd2db274c3bda04beaf5085e746f 29-Feb-2012 David Chisnall <csdavec@swan.ac.uk> Solaris port. Currently sees around 200 test failures, mostly related to
Solaris not providing some of the locales that the test suite uses.

Note: This depends on an xlocale (partial) implementation for Solaris and a
couple of fixed standard headers. These will be committed to a branch later
today.



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151720 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/random.cpp
b64f8b07c104c6cc986570ac8ee0ed16a9f23976 16-Nov-2010 Howard Hinnant <hhinnant@apple.com> license change

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119395 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/random.cpp
16e6e1d72fd6a10fc165eba4ca4ed2fa7c45df78 22-Aug-2010 Howard Hinnant <hhinnant@apple.com> Fixing whitespace problems

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111751 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/random.cpp
f5256e16dfc425c1d466f6308d4026d529ce9e0b 11-May-2010 Howard Hinnant <hhinnant@apple.com> Wiped out some non-ascii characters that snuck into the copyright.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@103516 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/random.cpp
bc8d3f97eb5c958007f2713238472e0c1c8fe02c 11-May-2010 Howard Hinnant <hhinnant@apple.com> libcxx initial import

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@103490 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/random.cpp