File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44# include " pal_bsd_aligned.h"
55
66# include < fcntl.h>
7+ # include < sys/syscall.h>
78
89/* *
910 * We skip the pthread cancellation checkpoints by reaching directly
@@ -42,12 +43,20 @@ namespace snmalloc
4243 PALBSD_Aligned::pal_features | Entropy;
4344
4445 /* *
45- * Temporary solution while waiting getrandom support for the next release
46+ * Temporary solution for NetBSD < 10
4647 * random_device seems unimplemented in clang for this platform
48+ * otherwise using getrandom
4749 */
4850 static uint64_t get_entropy64 ()
4951 {
52+ # if defined(SYS_getrandom)
53+ uint64_t result;
54+ if (getrandom (&result, sizeof (result), 0 ) != sizeof (result))
55+ error (" Failed to get system randomness" );
56+ return result;
57+ # else
5058 return PALPOSIX::dev_urandom ();
59+ # endif
5160 }
5261 };
5362} // namespace snmalloc
You can’t perform that action at this time.
0 commit comments