11 #elif defined(__FreeBSD__)
12 #include "os-freebsd.h"
13 #elif defined(__NetBSD__)
14 #include "os-netbsd.h"
15 #elif defined(__sun__)
16 #include "os-solaris.h"
17 #elif defined(__APPLE__)
21 #elif defined(__CYGWIN__)
22 #include "os-windows.h"
24 #error "unsupported os"
27 #ifdef FIO_HAVE_LIBAIO
31 #ifdef FIO_HAVE_POSIXAIO
40 #ifndef FIO_HAVE_STRSEP
41 #include "../lib/strsep.h"
45 #define OS_MSG_DONTWAIT MSG_DONTWAIT
48 #ifndef FIO_HAVE_FADVISE
49 #define posix_fadvise(fd, off, len, advice) (0)
51 #ifndef POSIX_FADV_DONTNEED
52 #define POSIX_FADV_DONTNEED (0)
53 #define POSIX_FADV_SEQUENTIAL (0)
54 #define POSIX_FADV_RANDOM (0)
56 #endif /* FIO_HAVE_FADVISE */
58 #ifndef FIO_HAVE_CPU_AFFINITY
59 #define fio_setaffinity(pid, mask) (0)
60 #define fio_getaffinity(pid, mask) do { } while (0)
61 #define fio_cpu_clear(mask, cpu) do { } while (0)
62 #define fio_cpuset_exit(mask) (-1)
63 typedef unsigned long os_cpu_mask_t;
66 #ifndef FIO_HAVE_IOPRIO
67 #define ioprio_set(which, who, prio) (0)
70 #ifndef FIO_HAVE_ODIRECT
73 #define OS_O_DIRECT O_DIRECT
76 #ifndef FIO_HAVE_HUGETLB
79 #define FIO_HUGE_PAGE 0
83 #define FIO_HUGE_PAGE 4194304
88 #define FIO_O_NOATIME 0
92 #define OS_RAND_MAX RAND_MAX
95 #ifdef FIO_HAVE_CLOCK_MONOTONIC
96 #define FIO_TIMER_CLOCK CLOCK_MONOTONIC
98 #define FIO_TIMER_CLOCK CLOCK_REALTIME
101 #ifndef FIO_HAVE_RAWBIND
102 #define fio_lookup_raw(dev, majdev, mindev) 1
105 #ifndef FIO_PREFERRED_ENGINE
106 #define FIO_PREFERRED_ENGINE "sync"
109 #ifndef FIO_HAVE_BLKTRACE
110 static inline int is_blktrace(const char *fname)
115 static inline int load_blktrace(struct thread_data *td, const char *fname)
121 #define FIO_DEF_CL_SIZE 128
123 static inline int os_cache_line_size(void)
125 #ifdef FIO_HAVE_CL_SIZE
126 int ret = arch_cache_line_size();
129 return FIO_DEF_CL_SIZE;
133 return FIO_DEF_CL_SIZE;
137 #ifdef FIO_USE_GENERIC_BDEV_SIZE
138 static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
144 end = lseek(f->fd, 0, SEEK_END);
153 #ifdef FIO_USE_GENERIC_RAND
154 typedef unsigned int os_random_state_t;
156 static inline void os_random_seed(unsigned long seed, os_random_state_t *rs)
161 static inline long os_random_long(os_random_state_t *rs)
170 #ifndef FIO_HAVE_FS_STAT
171 static inline unsigned long long get_fs_size(const char *path)