summaryrefslogtreecommitdiff
path: root/linux/sched.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/sched.c')
-rw-r--r--linux/sched.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/linux/sched.c b/linux/sched.c
index 898ccb19..cc614b12 100644
--- a/linux/sched.c
+++ b/linux/sched.c
@@ -179,3 +179,17 @@ static void sched_init(void)
rcu_init();
rcu_register_thread();
}
+
+#ifndef __NR_getrandom
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+int urandom_fd;
+
+__attribute__((constructor(101)))
+static void rand_init(void)
+{
+ urandom_fd = open("/dev/urandom", O_RDONLY);
+ BUG_ON(urandom_fd < 0);
+}
+#endif