* Rewritten to use reentrant functions by Ulrich Drepper, 1995.
*/
-#define random_r __random_r
-#define srandom_r __srandom_r
-
#define _GNU_SOURCE
#include <features.h>
#include <limits.h>
#include <stddef.h>
#include <stdlib.h>
+
+libc_hidden_proto(random_r)
+libc_hidden_proto(srandom_r)
+libc_hidden_proto(setstate_r)
+libc_hidden_proto(initstate_r)
+
#ifdef __UCLIBC_HAS_THREADS__
-#include <pthread.h>
+# include <pthread.h>
/* POSIX.1c requires that there is mutual exclusion for the `rand' and
`srand' functions to prevent concurrent calls from modifying common
data. */
static pthread_mutex_t lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
-#else
-#define __pthread_mutex_lock(x)
-#define __pthread_mutex_unlock(x)
#endif
/* An improved random number generation package. In addition to the standard
srandom_r (x, &unsafe_state);
__pthread_mutex_unlock(&lock);
}
-weak_alias (srandom, srand)
+strong_alias(srandom,srand)
/* Initialize the state information in the given array of N bytes for
future random number generation. Based on the number of bytes we
rear pointers can't wrap on the same call by not testing the rear
pointer if the front one has wrapped. Returns a 31-bit random number. */
-long int attribute_hidden __random (void)
+long int random (void)
{
int32_t retval;
__pthread_mutex_unlock(&lock);
return retval;
}
-strong_alias(__random,random)
+libc_hidden_proto(random)
+libc_hidden_def(random)