823b039a01ab30e61efaf7742588fb179ea3b8b0
[fio.git] / os / os.h
1 #ifndef FIO_OS_H
2 #define FIO_OS_H
3
4 #if defined(__linux__)
5 #include "os-linux.h"
6 #elif defined(__FreeBSD__)
7 #include "os-freebsd.h"
8 #elif defined(__sun__)
9 #include "os-solaris.h"
10 #else
11 #error "unsupported os"
12 #endif
13
14 #ifdef FIO_HAVE_LIBAIO
15 #include <libaio.h>
16 #endif
17
18 #ifdef FIO_HAVE_POSIXAIO
19 #include <aio.h>
20 #endif
21
22 #ifdef FIO_HAVE_SGIO
23 #include <linux/fs.h>
24 #include <scsi/sg.h>
25 #endif
26
27 #ifndef FIO_HAVE_STRSEP
28 #include "../lib/strsep.h"
29 #endif
30
31 #ifndef FIO_HAVE_FADVISE
32 #define fadvise(fd, off, len, advice)   (0)
33
34 #ifndef POSIX_FADV_DONTNEED
35 #define POSIX_FADV_DONTNEED     (0)
36 #define POSIX_FADV_SEQUENTIAL   (0)
37 #define POSIX_FADV_RANDOM       (0)
38 #endif
39 #endif /* FIO_HAVE_FADVISE */
40
41 #ifndef FIO_HAVE_CPU_AFFINITY
42 #define fio_setaffinity(td)             (0)
43 #define fio_getaffinity(pid, mask)      do { } while (0)
44 #define fio_cpu_clear(mask, cpu)        do { } while (0)
45 #endif
46
47 #ifndef FIO_HAVE_IOPRIO
48 #define ioprio_set(which, who, prio)    (0)
49 #endif
50
51 #ifndef FIO_HAVE_ODIRECT
52 #define OS_O_DIRECT                     0
53 #else
54 #define OS_O_DIRECT                     O_DIRECT
55 #endif
56
57 #ifndef FIO_HAVE_HUGETLB
58 #define SHM_HUGETLB                     0
59 #ifndef FIO_HUGE_PAGE
60 #define FIO_HUGE_PAGE                   0
61 #endif
62 #else
63 #ifndef FIO_HUGE_PAGE
64 #define FIO_HUGE_PAGE                   4194304
65 #endif
66 #endif
67
68 #ifndef FIO_O_NOATIME
69 #define FIO_O_NOATIME                   0
70 #endif
71
72 #ifndef OS_RAND_MAX
73 #define OS_RAND_MAX                     RAND_MAX
74 #endif
75
76 #ifndef FIO_HAVE_RAWBIND
77 #define fio_lookup_raw(dev, majdev, mindev)     1
78 #endif
79
80 #ifndef FIO_HAVE_BLKTRACE
81 static inline int is_blktrace(const char *fname)
82 {
83         return 0;
84 }
85 struct thread_data;
86 static inline int load_blktrace(struct thread_data *td, const char *fname)
87 {
88         return 1;
89 }
90 #endif
91
92 #endif