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__)
20 #error "unsupported os"
23 #ifdef FIO_HAVE_LIBAIO
27 #ifdef FIO_HAVE_POSIXAIO
36 #ifndef FIO_HAVE_STRSEP
37 #include "../lib/strsep.h"
40 #ifndef FIO_HAVE_FADVISE
41 #define fadvise(fd, off, len, advice) (0)
43 #ifndef POSIX_FADV_DONTNEED
44 #define POSIX_FADV_DONTNEED (0)
45 #define POSIX_FADV_SEQUENTIAL (0)
46 #define POSIX_FADV_RANDOM (0)
48 #endif /* FIO_HAVE_FADVISE */
50 #ifndef FIO_HAVE_CPU_AFFINITY
51 #define fio_setaffinity(pid, mask) (0)
52 #define fio_getaffinity(pid, mask) do { } while (0)
53 #define fio_cpu_clear(mask, cpu) do { } while (0)
54 #define fio_cpuset_exit(mask) (-1)
55 typedef unsigned long os_cpu_mask_t;
58 #ifndef FIO_HAVE_IOPRIO
59 #define ioprio_set(which, who, prio) (0)
62 #ifndef FIO_HAVE_ODIRECT
65 #define OS_O_DIRECT O_DIRECT
68 #ifndef FIO_HAVE_HUGETLB
71 #define FIO_HUGE_PAGE 0
75 #define FIO_HUGE_PAGE 4194304
80 #define FIO_O_NOATIME 0
84 #define OS_RAND_MAX RAND_MAX
87 #ifndef FIO_HAVE_RAWBIND
88 #define fio_lookup_raw(dev, majdev, mindev) 1
91 #ifndef FIO_HAVE_BLKTRACE
92 static inline int is_blktrace(const char *fname)
97 static inline int load_blktrace(struct thread_data *td, const char *fname)
103 #define FIO_DEF_CL_SIZE 128
105 static inline int os_cache_line_size(void)
107 #ifdef FIO_HAVE_CL_SIZE
108 int ret = arch_cache_line_size();
111 return FIO_DEF_CL_SIZE;
115 return FIO_DEF_CL_SIZE;
119 #ifdef FIO_USE_GENERIC_BDEV_SIZE
120 static inline int blockdev_size(int fd, unsigned long long *bytes)
126 end = lseek(fd, 0, SEEK_END);
135 #ifdef FIO_USE_GENERIC_RAND
136 typedef unsigned int os_random_state_t;
138 static inline void os_random_seed(unsigned long seed, os_random_state_t *rs)
143 static inline long os_random_long(os_random_state_t *rs)
152 #ifndef FIO_HAVE_FS_STAT
153 static inline unsigned long long get_fs_size(const char *path)