srand and rand are no longer used in the tree. In fact, all randomness
used in tree goes through ul_random_get_bytes.
Reduce macro and function visibility to randutils.c where they are still
used.
While at it, update comment.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
#ifndef UTIL_LINUX_RANDUTILS
#define UTIL_LINUX_RANDUTILS
-#ifdef HAVE_SRANDOM
-#define srand(x) srandom(x)
-#define rand() random()
-#endif
-
-/* /dev/urandom based with fallback to rand() */
-extern int random_get_fd(void);
+/* getrandom(2) based with fallback to /dev/(u)random and libc randomness */
extern int ul_random_get_bytes(void *buf, size_t nbytes);
extern const char *random_tell_source(void);
# define HAVE_GETRANDOM
#endif
+#ifdef HAVE_SRANDOM
+#define srand(x) srandom(x)
+#define rand() random()
+#endif
+
#if defined(__linux__) && defined(__NR_gettid) && defined(HAVE_JRAND48)
#define DO_JRAND_MIX
THREAD_LOCAL unsigned short ul_jrand_seed[3];
rand();
}
-int random_get_fd(void)
+static int random_get_fd(void)
{
int fd;