diff options
author | David Timber <mieabby@gmail.com> | 2020-08-10 13:57:00 +0930 |
---|---|---|
committer | David Timber <mieabby@gmail.com> | 2020-08-10 13:57:00 +0930 |
commit | 195946d11f8a7870b435e0eba32f2299aa1b96a1 (patch) | |
tree | 62470aff372efb7cb66d9a90c1fc33c60b19738f /src/util_rt.c | |
parent | d61c0f9ddba9176c09ed751587343f3268ac6812 (diff) |
Changes for xcomp ...
* Add 'pthsem' dependency
* Remove m68k, spc arch
* Add proone-stress, proone-arch-test
Diffstat (limited to 'src/util_rt.c')
-rw-r--r-- | src/util_rt.c | 16 |
1 files changed, 16 insertions, 0 deletions
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; +} |