X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=os%2Fos.h;h=8d2a6ae8cd0923a5b29b92bf23ba1052e7065a97;hp=12188156cf280afea5ca29935d74ee794058228b;hb=79074e7c8c01a355be5b6d3a84df101100f93a66;hpb=cca84643cc10cd72b0b453ff92ccb8643ba51493 diff --git a/os/os.h b/os/os.h index 12188156..8d2a6ae8 100644 --- a/os/os.h +++ b/os/os.h @@ -2,6 +2,8 @@ #define FIO_OS_H #include +#include +#include #include #include #include @@ -33,7 +35,7 @@ enum { #include "os-aix.h" #elif defined(__hpux) #include "os-hpux.h" -#elif defined(__CYGWIN__) +#elif defined(WIN32) #include "os-windows.h" #else #error "unsupported os" @@ -124,6 +126,14 @@ typedef unsigned long os_cpu_mask_t; #define FIO_PREFERRED_ENGINE "sync" #endif +#ifndef FIO_OS_PATH_SEPARATOR +#define FIO_OS_PATH_SEPARATOR "/" +#endif + +#ifndef FIO_PREFERRED_CLOCK_SOURCE +#define FIO_PREFERRED_CLOCK_SOURCE CS_CGETTIME +#endif + #ifndef FIO_MAX_JOBS #define FIO_MAX_JOBS 2048 #endif @@ -258,6 +268,32 @@ static inline long os_random_long(os_random_state_t *rs) } #endif +#ifdef FIO_USE_GENERIC_INIT_RANDOM_STATE +extern void td_fill_rand_seeds(struct thread_data *td); +/* + * Initialize the various random states we need (random io, block size ranges, + * read/write mix, etc). + */ +static inline int init_random_state(struct thread_data *td, unsigned long *rand_seeds, int size) +{ + int fd; + + fd = open("/dev/urandom", O_RDONLY); + if (fd == -1) { + return 1; + } + + if (read(fd, rand_seeds, size) < size) { + close(fd); + return 1; + } + + close(fd); + td_fill_rand_seeds(td); + return 0; +} +#endif + #ifndef FIO_HAVE_FS_STAT static inline unsigned long long get_fs_size(const char *path) {