Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 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" |
Jens Axboe | 2c0ecd2 | 2006-06-08 13:25:41 +0200 | [diff] [blame] | 8 | #elif defined(__sun__) |
| 9 | #include "os-solaris.h" |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 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 | |
Jens Axboe | 5921e80 | 2008-05-30 15:02:38 +0200 | [diff] [blame] | 27 | #ifndef FIO_HAVE_STRSEP |
Jens Axboe | 00fb3c8 | 2008-05-30 22:17:45 +0200 | [diff] [blame] | 28 | #include "../lib/strsep.h" |
Jens Axboe | 5921e80 | 2008-05-30 15:02:38 +0200 | [diff] [blame] | 29 | #endif |
| 30 | |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 31 | #ifndef FIO_HAVE_FADVISE |
| 32 | #define fadvise(fd, off, len, advice) (0) |
| 33 | |
Shawn Lewis | 4d8947d | 2007-07-25 07:51:58 +0200 | [diff] [blame] | 34 | #ifndef POSIX_FADV_DONTNEED |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 35 | #define POSIX_FADV_DONTNEED (0) |
| 36 | #define POSIX_FADV_SEQUENTIAL (0) |
| 37 | #define POSIX_FADV_RANDOM (0) |
Shawn Lewis | 4d8947d | 2007-07-25 07:51:58 +0200 | [diff] [blame] | 38 | #endif |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 39 | #endif /* FIO_HAVE_FADVISE */ |
| 40 | |
| 41 | #ifndef FIO_HAVE_CPU_AFFINITY |
| 42 | #define fio_setaffinity(td) (0) |
Jens Axboe | be4ecfd | 2008-12-08 14:10:52 +0100 | [diff] [blame] | 43 | #define fio_getaffinity(pid, mask) do { } while (0) |
| 44 | #define fio_cpu_clear(mask, cpu) do { } while (0) |
Jens Axboe | 85daf2c | 2009-01-05 09:40:13 +0100 | [diff] [blame^] | 45 | #define fio_cpuset_exit(mask) (-1) |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 46 | #endif |
| 47 | |
| 48 | #ifndef FIO_HAVE_IOPRIO |
| 49 | #define ioprio_set(which, who, prio) (0) |
| 50 | #endif |
| 51 | |
Jens Axboe | 2c0ecd2 | 2006-06-08 13:25:41 +0200 | [diff] [blame] | 52 | #ifndef FIO_HAVE_ODIRECT |
Jens Axboe | 7d42476 | 2006-06-08 13:26:31 +0200 | [diff] [blame] | 53 | #define OS_O_DIRECT 0 |
| 54 | #else |
| 55 | #define OS_O_DIRECT O_DIRECT |
Jens Axboe | 2c0ecd2 | 2006-06-08 13:25:41 +0200 | [diff] [blame] | 56 | #endif |
| 57 | |
Jens Axboe | 74b025b | 2006-12-19 15:18:14 +0100 | [diff] [blame] | 58 | #ifndef FIO_HAVE_HUGETLB |
| 59 | #define SHM_HUGETLB 0 |
Shawn Lewis | 4d8947d | 2007-07-25 07:51:58 +0200 | [diff] [blame] | 60 | #ifndef FIO_HUGE_PAGE |
Jens Axboe | 74b025b | 2006-12-19 15:18:14 +0100 | [diff] [blame] | 61 | #define FIO_HUGE_PAGE 0 |
Shawn Lewis | 4d8947d | 2007-07-25 07:51:58 +0200 | [diff] [blame] | 62 | #endif |
Jens Axboe | 74b025b | 2006-12-19 15:18:14 +0100 | [diff] [blame] | 63 | #else |
Jens Axboe | cb25df6 | 2007-03-23 08:23:30 +0100 | [diff] [blame] | 64 | #ifndef FIO_HUGE_PAGE |
Jens Axboe | ee0e0a7 | 2007-03-19 10:50:47 +0100 | [diff] [blame] | 65 | #define FIO_HUGE_PAGE 4194304 |
Jens Axboe | 74b025b | 2006-12-19 15:18:14 +0100 | [diff] [blame] | 66 | #endif |
Jens Axboe | cb25df6 | 2007-03-23 08:23:30 +0100 | [diff] [blame] | 67 | #endif |
Jens Axboe | 74b025b | 2006-12-19 15:18:14 +0100 | [diff] [blame] | 68 | |
Jens Axboe | 5921e80 | 2008-05-30 15:02:38 +0200 | [diff] [blame] | 69 | #ifndef FIO_O_NOATIME |
| 70 | #define FIO_O_NOATIME 0 |
| 71 | #endif |
| 72 | |
Jens Axboe | dc873b6 | 2008-06-04 20:13:04 +0200 | [diff] [blame] | 73 | #ifndef OS_RAND_MAX |
| 74 | #define OS_RAND_MAX RAND_MAX |
| 75 | #endif |
| 76 | |
Jens Axboe | 07e5b26 | 2007-04-02 14:46:07 +0200 | [diff] [blame] | 77 | #ifndef FIO_HAVE_RAWBIND |
Jens Axboe | 8cc7afa | 2007-04-17 09:06:43 +0200 | [diff] [blame] | 78 | #define fio_lookup_raw(dev, majdev, mindev) 1 |
Jens Axboe | 07e5b26 | 2007-04-02 14:46:07 +0200 | [diff] [blame] | 79 | #endif |
| 80 | |
Jens Axboe | 5e62c22 | 2007-05-22 13:27:30 +0200 | [diff] [blame] | 81 | #ifndef FIO_HAVE_BLKTRACE |
| 82 | static inline int is_blktrace(const char *fname) |
| 83 | { |
| 84 | return 0; |
| 85 | } |
Jens Axboe | 5921e80 | 2008-05-30 15:02:38 +0200 | [diff] [blame] | 86 | struct thread_data; |
Jens Axboe | 5e62c22 | 2007-05-22 13:27:30 +0200 | [diff] [blame] | 87 | static inline int load_blktrace(struct thread_data *td, const char *fname) |
| 88 | { |
| 89 | return 1; |
| 90 | } |
| 91 | #endif |
| 92 | |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 93 | #endif |