projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tests: utils: lttng_pgrep spams output when racing with a process
[lttng-tools.git]
/
src
/
common
/
random.cpp
diff --git
a/src/common/random.cpp
b/src/common/random.cpp
index ec74688ec976df098f60ea330b3a7ae4eb4903e2..26f51d3a4a0a674e19c3721b69ee5ad23eefa2b0 100644
(file)
--- a/
src/common/random.cpp
+++ b/
src/common/random.cpp
@@
-72,6
+72,17
@@
void getrandom_nonblock(char *out_data, std::size_t size)
errno);
}
}
errno);
}
}
+#elif defined(HAVE_ARC4RANDOM)
+
+#include <stdlib.h>
+
+/*
+ * According to the MacOS / FreeBSD manpage, this function never fails nor blocks.
+ */
+void getrandom_nonblock(char *out_data, std::size_t size)
+{
+ arc4random_buf(out_data, size);
+}
#else /* defined(__linux__) && defined(SYS_getrandom) && defined(HAVE_SYS_RANDOM_H) */
__attribute__((noreturn)) void getrandom_nonblock(char *out_data __attribute__((unused)),
std::size_t size __attribute__((unused)))
#else /* defined(__linux__) && defined(SYS_getrandom) && defined(HAVE_SYS_RANDOM_H) */
__attribute__((noreturn)) void getrandom_nonblock(char *out_data __attribute__((unused)),
std::size_t size __attribute__((unused)))
This page took
0.026776 seconds
and
4
git commands to generate.