From 195946d11f8a7870b435e0eba32f2299aa1b96a1 Mon Sep 17 00:00:00 2001 From: David Timber Date: Mon, 10 Aug 2020 13:57:00 +0930 Subject: Changes for xcomp ... * Add 'pthsem' dependency * Remove m68k, spc arch * Add proone-stress, proone-arch-test --- src/util_rt.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/util_rt.c') diff --git a/src/util_rt.c b/src/util_rt.c index c582d08..cdf4526 100644 --- a/src/util_rt.c +++ b/src/util_rt.c @@ -446,3 +446,19 @@ bool prne_set_pipe_size (const int fd, const int size) { #endif ; } + +ssize_t prne_geturandom (void *buf, const size_t len) { + const int fd = open("/dev/urandom", O_RDONLY); + ssize_t ret; + int save_errno; + + if (fd < 0) { + return -1; + } + ret = read(fd, buf, len); + save_errno = errno; + close(fd); + errno = save_errno; + + return ret; +} -- cgit