9 #elif defined(__FreeBSD__)
10 #include "os-freebsd.h"
11 #elif defined(__sun__)
12 #include "os-solaris.h"
13 #elif defined(__APPLE__)
16 #error "unsupported os"
19 #ifdef FIO_HAVE_LIBAIO
23 #ifdef FIO_HAVE_POSIXAIO
32 #ifndef FIO_HAVE_STRSEP
33 #include "../lib/strsep.h"
36 #ifndef FIO_HAVE_FADVISE
37 #define fadvise(fd, off, len, advice) (0)
39 #ifndef POSIX_FADV_DONTNEED
40 #define POSIX_FADV_DONTNEED (0)
41 #define POSIX_FADV_SEQUENTIAL (0)
42 #define POSIX_FADV_RANDOM (0)
44 #endif /* FIO_HAVE_FADVISE */
46 #ifndef FIO_HAVE_CPU_AFFINITY
47 #define fio_setaffinity(pid, mask) (0)
48 #define fio_getaffinity(pid, mask) do { } while (0)
49 #define fio_cpu_clear(mask, cpu) do { } while (0)
50 #define fio_cpuset_exit(mask) (-1)
53 #ifndef FIO_HAVE_IOPRIO
54 #define ioprio_set(which, who, prio) (0)
57 #ifndef FIO_HAVE_ODIRECT
60 #define OS_O_DIRECT O_DIRECT
63 #ifndef FIO_HAVE_HUGETLB
66 #define FIO_HUGE_PAGE 0
70 #define FIO_HUGE_PAGE 4194304
75 #define FIO_O_NOATIME 0
79 #define OS_RAND_MAX RAND_MAX
82 #ifndef FIO_HAVE_RAWBIND
83 #define fio_lookup_raw(dev, majdev, mindev) 1
86 #ifndef FIO_HAVE_BLKTRACE
87 static inline int is_blktrace(const char *fname)
92 static inline int load_blktrace(struct thread_data *td, const char *fname)
98 #define FIO_DEF_CL_SIZE 128
100 static inline int os_cache_line_size(void)
102 #ifdef FIO_HAVE_CL_SIZE
103 int ret = arch_cache_line_size();
106 return FIO_DEF_CL_SIZE;
110 return FIO_DEF_CL_SIZE;
114 #ifdef FIO_USE_GENERIC_BDEV_SIZE
115 static inline int blockdev_size(int fd, unsigned long long *bytes)
121 end = lseek(fd, 0, SEEK_END);
130 #ifdef FIO_USE_GENERIC_RAND
131 typedef unsigned int os_random_state_t;
133 static inline void os_random_seed(unsigned long seed, os_random_state_t *rs)
138 static inline long os_random_long(os_random_state_t *rs)