9 #elif defined(__FreeBSD__)
10 #include "os-freebsd.h"
11 #elif defined(__NetBSD__)
12 #include "os-netbsd.h"
13 #elif defined(__sun__)
14 #include "os-solaris.h"
15 #elif defined(__APPLE__)
18 #error "unsupported os"
21 #ifdef FIO_HAVE_LIBAIO
25 #ifdef FIO_HAVE_POSIXAIO
34 #ifndef FIO_HAVE_STRSEP
35 #include "../lib/strsep.h"
38 #ifndef FIO_HAVE_FADVISE
39 #define fadvise(fd, off, len, advice) (0)
41 #ifndef POSIX_FADV_DONTNEED
42 #define POSIX_FADV_DONTNEED (0)
43 #define POSIX_FADV_SEQUENTIAL (0)
44 #define POSIX_FADV_RANDOM (0)
46 #endif /* FIO_HAVE_FADVISE */
48 #ifndef FIO_HAVE_CPU_AFFINITY
49 #define fio_setaffinity(pid, mask) (0)
50 #define fio_getaffinity(pid, mask) do { } while (0)
51 #define fio_cpu_clear(mask, cpu) do { } while (0)
52 #define fio_cpuset_exit(mask) (-1)
53 typedef unsigned long os_cpu_mask_t;
56 #ifndef FIO_HAVE_IOPRIO
57 #define ioprio_set(which, who, prio) (0)
60 #ifndef FIO_HAVE_ODIRECT
63 #define OS_O_DIRECT O_DIRECT
66 #ifndef FIO_HAVE_HUGETLB
69 #define FIO_HUGE_PAGE 0
73 #define FIO_HUGE_PAGE 4194304
78 #define FIO_O_NOATIME 0
82 #define OS_RAND_MAX RAND_MAX
85 #ifndef FIO_HAVE_RAWBIND
86 #define fio_lookup_raw(dev, majdev, mindev) 1
89 #ifndef FIO_HAVE_BLKTRACE
90 static inline int is_blktrace(const char *fname)
95 static inline int load_blktrace(struct thread_data *td, const char *fname)
101 #define FIO_DEF_CL_SIZE 128
103 static inline int os_cache_line_size(void)
105 #ifdef FIO_HAVE_CL_SIZE
106 int ret = arch_cache_line_size();
109 return FIO_DEF_CL_SIZE;
113 return FIO_DEF_CL_SIZE;
117 #ifdef FIO_USE_GENERIC_BDEV_SIZE
118 static inline int blockdev_size(int fd, unsigned long long *bytes)
124 end = lseek(fd, 0, SEEK_END);
133 #ifdef FIO_USE_GENERIC_RAND
134 typedef unsigned int os_random_state_t;
136 static inline void os_random_seed(unsigned long seed, os_random_state_t *rs)
141 static inline long os_random_long(os_random_state_t *rs)
150 #ifndef FIO_HAVE_FS_STAT
151 static inline unsigned long long get_fs_size(const char *path)