Apparently, some atheros drivers want rand(), so implement it (in terms

of random()).

Requested by: juli
Bribe offered: tacos
This commit is contained in:
Bill Paul 2004-03-27 20:38:43 +00:00
parent 63946e47cf
commit 60a6006b6c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=127503

View File

@ -147,6 +147,7 @@ __stdcall static ndis_status ntoskrnl_unicode_to_int(ndis_unicode_string *,
uint32_t, uint32_t *);
static int atoi (const char *);
static long atol (const char *);
static int rand(void);
static void ntoskrnl_time(uint64_t *);
__stdcall static uint8_t ntoskrnl_wdmver(uint8_t, uint8_t);
static void ntoskrnl_thrfunc(void *);
@ -1355,6 +1356,16 @@ atol(str)
return strtol(str, (char **)NULL, 10);
}
static int
rand(void)
{
struct timeval tv;
microtime(&tv);
srandom(tv.tv_usec);
return((int)random());
}
__stdcall static uint8_t
ntoskrnl_wdmver(major, minor)
uint8_t major;
@ -1908,6 +1919,7 @@ image_patch_table ntoskrnl_functbl[] = {
{ "_aullshl", (FUNC)_aullshl },
{ "atoi", (FUNC)atoi },
{ "atol", (FUNC)atol },
{ "rand", (FUNC)rand },
{ "WRITE_REGISTER_USHORT", (FUNC)ntoskrnl_writereg_ushort },
{ "READ_REGISTER_USHORT", (FUNC)ntoskrnl_readreg_ushort },
{ "WRITE_REGISTER_ULONG", (FUNC)ntoskrnl_writereg_ulong },