diff options
author | wpaul <wpaul@FreeBSD.org> | 2004-03-27 20:38:43 +0000 |
---|---|---|
committer | wpaul <wpaul@FreeBSD.org> | 2004-03-27 20:38:43 +0000 |
commit | b41d925167717d0521d046c8ed82094f3d546f53 (patch) | |
tree | b7b985e93ef090110a1260e43346b1c55411535c /sys/compat/ndis | |
parent | bfbc3417299f5addc6f4f3246ff9208b60f876e2 (diff) | |
download | FreeBSD-src-b41d925167717d0521d046c8ed82094f3d546f53.zip FreeBSD-src-b41d925167717d0521d046c8ed82094f3d546f53.tar.gz |
Apparently, some atheros drivers want rand(), so implement it (in terms
of random()).
Requested by: juli
Bribe offered: tacos
Diffstat (limited to 'sys/compat/ndis')
-rw-r--r-- | sys/compat/ndis/subr_ntoskrnl.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/compat/ndis/subr_ntoskrnl.c b/sys/compat/ndis/subr_ntoskrnl.c index c58e8a3..8c9646c 100644 --- a/sys/compat/ndis/subr_ntoskrnl.c +++ b/sys/compat/ndis/subr_ntoskrnl.c @@ -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 }, |