X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=os-freebsd.h;h=41672d4e10231b3be0a8d3be4e92aa8c45478fe1;hp=31fa01071aaf283410a4059bcd40cdb670cd8268;hb=5c4e1dbc4ec6ee963220c5f4e64a04cd6130dc81;hpb=32cd46a085ac60f4f8b085e2d65ebfc6100bb8c5 diff --git a/os-freebsd.h b/os-freebsd.h index 31fa0107..41672d4e 100644 --- a/os-freebsd.h +++ b/os-freebsd.h @@ -1,6 +1,8 @@ #ifndef FIO_OS_FREEBSD_H #define FIO_OS_FREEBSD_H +#include + #undef FIO_HAVE_LIBAIO #define FIO_HAVE_POSIXAIO #undef FIO_HAVE_FADVISE @@ -11,6 +13,7 @@ #define OS_MAP_ANON (MAP_ANON) typedef unsigned long os_cpu_mask_t; +typedef unsigned int os_random_state_t; /* * FIXME @@ -30,4 +33,24 @@ static inline unsigned long long os_phys_mem(void) return mem; } +static inline void os_random_seed(unsigned long seed, os_random_state_t *rs) +{ + srand(seed); +} + +static inline long os_random_long(os_random_state_t *rs) +{ + long val; + + val = rand_r(rs); + return val; +} + +static inline double os_random_double(os_random_state_t *rs) +{ + double val; + + val = (double) rand_r(rs); + return val; +} #endif