blob: 2dfed5e2dc042aeb5546ad9a5be91609749da089 [file] [log] [blame]
Jens Axboeebac4652005-12-08 15:25:21 +01001#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 Axboe2c0ecd22006-06-08 13:25:41 +02008#elif defined(__sun__)
9#include "os-solaris.h"
Jens Axboeebac4652005-12-08 15:25:21 +010010#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 Axboe5921e802008-05-30 15:02:38 +020027#ifndef FIO_HAVE_STRSEP
Jens Axboe00fb3c82008-05-30 22:17:45 +020028#include "../lib/strsep.h"
Jens Axboe5921e802008-05-30 15:02:38 +020029#endif
30
Jens Axboeebac4652005-12-08 15:25:21 +010031#ifndef FIO_HAVE_FADVISE
32#define fadvise(fd, off, len, advice) (0)
33
Shawn Lewis4d8947d2007-07-25 07:51:58 +020034#ifndef POSIX_FADV_DONTNEED
Jens Axboeebac4652005-12-08 15:25:21 +010035#define POSIX_FADV_DONTNEED (0)
36#define POSIX_FADV_SEQUENTIAL (0)
37#define POSIX_FADV_RANDOM (0)
Shawn Lewis4d8947d2007-07-25 07:51:58 +020038#endif
Jens Axboeebac4652005-12-08 15:25:21 +010039#endif /* FIO_HAVE_FADVISE */
40
41#ifndef FIO_HAVE_CPU_AFFINITY
42#define fio_setaffinity(td) (0)
Jens Axboe5921e802008-05-30 15:02:38 +020043#define fio_getaffinity(pid, mask) do { } while(0)
Jens Axboeebac4652005-12-08 15:25:21 +010044#endif
45
46#ifndef FIO_HAVE_IOPRIO
47#define ioprio_set(which, who, prio) (0)
48#endif
49
Jens Axboe2c0ecd22006-06-08 13:25:41 +020050#ifndef FIO_HAVE_ODIRECT
Jens Axboe7d424762006-06-08 13:26:31 +020051#define OS_O_DIRECT 0
52#else
53#define OS_O_DIRECT O_DIRECT
Jens Axboe2c0ecd22006-06-08 13:25:41 +020054#endif
55
Jens Axboe74b025b2006-12-19 15:18:14 +010056#ifndef FIO_HAVE_HUGETLB
57#define SHM_HUGETLB 0
Shawn Lewis4d8947d2007-07-25 07:51:58 +020058#ifndef FIO_HUGE_PAGE
Jens Axboe74b025b2006-12-19 15:18:14 +010059#define FIO_HUGE_PAGE 0
Shawn Lewis4d8947d2007-07-25 07:51:58 +020060#endif
Jens Axboe74b025b2006-12-19 15:18:14 +010061#else
Jens Axboecb25df62007-03-23 08:23:30 +010062#ifndef FIO_HUGE_PAGE
Jens Axboeee0e0a72007-03-19 10:50:47 +010063#define FIO_HUGE_PAGE 4194304
Jens Axboe74b025b2006-12-19 15:18:14 +010064#endif
Jens Axboecb25df62007-03-23 08:23:30 +010065#endif
Jens Axboe74b025b2006-12-19 15:18:14 +010066
Jens Axboe5921e802008-05-30 15:02:38 +020067#ifndef FIO_O_NOATIME
68#define FIO_O_NOATIME 0
69#endif
70
Jens Axboe07e5b262007-04-02 14:46:07 +020071#ifndef FIO_HAVE_RAWBIND
Jens Axboe8cc7afa2007-04-17 09:06:43 +020072#define fio_lookup_raw(dev, majdev, mindev) 1
Jens Axboe07e5b262007-04-02 14:46:07 +020073#endif
74
Jens Axboe5e62c222007-05-22 13:27:30 +020075#ifndef FIO_HAVE_BLKTRACE
76static inline int is_blktrace(const char *fname)
77{
78 return 0;
79}
Jens Axboe5921e802008-05-30 15:02:38 +020080struct thread_data;
Jens Axboe5e62c222007-05-22 13:27:30 +020081static inline int load_blktrace(struct thread_data *td, const char *fname)
82{
83 return 1;
84}
85#endif
86
Jens Axboeebac4652005-12-08 15:25:21 +010087#endif