[libcxx-commits] [PATCH] D125068: [libcxx] random_device, use arc4random() on Solaris

Brad Smith via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu May 5 19:57:03 PDT 2022


brad created this revision.
brad added reviewers: ro, ldionne, libc++.
brad added a project: libc++.
Herald added subscribers: fedor.sergeev, krytarowski.
Herald added a project: All.
brad requested review of this revision.
Herald added 1 blocking reviewer(s): libc++.

Solaris also has arc4random().


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125068

Files:
  libcxx/docs/ReleaseNotes.rst
  libcxx/include/__config


Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -351,7 +351,7 @@
 //      When this option is used, the token passed to `std::random_device`'s
 //      constructor *must* be "/dev/urandom" -- anything else is an error.
 #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
-    defined(__OpenBSD__) || defined(__DragonFly__)
+    defined(__OpenBSD__) || defined(__DragonFly__) || defined(__sun__)
 #  define _LIBCPP_USING_ARC4_RANDOM
 #elif defined(__wasi__)
 #  define _LIBCPP_USING_GETENTROPY
Index: libcxx/docs/ReleaseNotes.rst
===================================================================
--- libcxx/docs/ReleaseNotes.rst
+++ libcxx/docs/ReleaseNotes.rst
@@ -102,8 +102,8 @@
   ``_LIBCPP_ABI_USE_CXX03_NULLPTR_EMULATION`` will not be honoured anymore and there
   will be no way to opt back into the C++03 emulation of ``std::nullptr_t``.
 
-- On FreeBSD, NetBSD and DragonFlyBSD, ``std::random_device`` is now implemented on top of
-  ``arc4random()`` instead of reading from ``/dev/urandom``. Any implementation-defined
+- On FreeBSD, NetBSD, DragonFlyBSD and Solaris, ``std::random_device`` is now implemented on
+  top of ``arc4random()`` instead of reading from ``/dev/urandom``. Any implementation-defined
   token used when constructing a ``std::random_device`` will now be ignored instead of
   interpreted as a file to read entropy from.
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125068.427518.patch
Type: text/x-patch
Size: 1491 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220506/3f67025f/attachment.bin>


More information about the libcxx-commits mailing list