2dfed5e2dc042aeb5546ad9a5be91609749da089
[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 #endif
45
46 #ifndef FIO_HAVE_IOPRIO
47 #define ioprio_set(which, who, prio)    (0)
48 #endif
49
50 #ifndef FIO_HAVE_ODIRECT
51 #define OS_O_DIRECT                     0
52 #else
53 #define OS_O_DIRECT                     O_DIRECT
54 #endif
55
56 #ifndef FIO_HAVE_HUGETLB
57 #define SHM_HUGETLB                     0
58 #ifndef FIO_HUGE_PAGE
59 #define FIO_HUGE_PAGE                   0
60 #endif
61 #else
62 #ifndef FIO_HUGE_PAGE
63 #define FIO_HUGE_PAGE                   4194304
64 #endif
65 #endif
66
67 #ifndef FIO_O_NOATIME
68 #define FIO_O_NOATIME                   0
69 #endif
70
71 #ifndef FIO_HAVE_RAWBIND
72 #define fio_lookup_raw(dev, majdev, mindev)     1
73 #endif
74
75 #ifndef FIO_HAVE_BLKTRACE
76 static inline int is_blktrace(const char *fname)
77 {
78         return 0;
79 }
80 struct thread_data;
81 static inline int load_blktrace(struct thread_data *td, const char *fname)
82 {
83         return 1;
84 }
85 #endif
86
87 #endif