Jens Axboe | 2c0ecd2 | 2006-06-08 13:25:41 +0200 | [diff] [blame] | 1 | #ifndef FIO_OS_SOLARIS_H |
| 2 | #define FIO_OS_SOLARIS_H |
| 3 | |
Jens Axboe | e116f2b | 2008-06-04 15:14:24 +0200 | [diff] [blame] | 4 | #include <sys/types.h> |
| 5 | #include <sys/fcntl.h> |
| 6 | |
Jens Axboe | 2c0ecd2 | 2006-06-08 13:25:41 +0200 | [diff] [blame] | 7 | #define FIO_HAVE_POSIXAIO |
Jens Axboe | 417f006 | 2008-06-02 11:59:30 +0200 | [diff] [blame] | 8 | #define FIO_HAVE_SOLARISAIO |
Jens Axboe | fffca02 | 2008-06-02 12:23:40 +0200 | [diff] [blame] | 9 | #define FIO_HAVE_FALLOCATE |
Jens Axboe | 207cb0f | 2008-06-02 12:28:02 +0200 | [diff] [blame] | 10 | #define FIO_HAVE_POSIXAIO_FSYNC |
Jens Axboe | 2c0ecd2 | 2006-06-08 13:25:41 +0200 | [diff] [blame] | 11 | |
| 12 | #define OS_MAP_ANON (MAP_ANON) |
| 13 | |
Jens Axboe | f022ddb | 2008-06-04 19:55:58 +0200 | [diff] [blame^] | 14 | struct solaris_rand_seed { |
| 15 | unsigned short r[3]; |
| 16 | }; |
| 17 | |
Jens Axboe | 2c0ecd2 | 2006-06-08 13:25:41 +0200 | [diff] [blame] | 18 | typedef unsigned long os_cpu_mask_t; |
Jens Axboe | f022ddb | 2008-06-04 19:55:58 +0200 | [diff] [blame^] | 19 | typedef struct solaris_rand_seed os_random_state_t; |
Jens Axboe | 2c0ecd2 | 2006-06-08 13:25:41 +0200 | [diff] [blame] | 20 | |
| 21 | /* |
| 22 | * FIXME |
| 23 | */ |
| 24 | static inline int blockdev_size(int fd, unsigned long long *bytes) |
| 25 | { |
Jens Axboe | e5b401d | 2006-10-18 16:03:40 +0200 | [diff] [blame] | 26 | return EINVAL; |
| 27 | } |
| 28 | |
| 29 | static inline int blockdev_invalidate_cache(int fd) |
| 30 | { |
| 31 | return EINVAL; |
Jens Axboe | 2c0ecd2 | 2006-06-08 13:25:41 +0200 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | static inline unsigned long long os_phys_mem(void) |
| 35 | { |
Jens Axboe | 2c0ecd2 | 2006-06-08 13:25:41 +0200 | [diff] [blame] | 36 | return 0; |
Jens Axboe | 2c0ecd2 | 2006-06-08 13:25:41 +0200 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | static inline void os_random_seed(unsigned long seed, os_random_state_t *rs) |
| 40 | { |
Jens Axboe | f022ddb | 2008-06-04 19:55:58 +0200 | [diff] [blame^] | 41 | rs->r[0] = seed & 0xffff; |
| 42 | seed >>= 16; |
| 43 | rs->r[1] = seed & 0xffff; |
| 44 | seed >>= 16; |
| 45 | rs->r[2] = seed & 0xffff; |
| 46 | seed48(rs->r); |
Jens Axboe | 2c0ecd2 | 2006-06-08 13:25:41 +0200 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | static inline long os_random_long(os_random_state_t *rs) |
| 50 | { |
Jens Axboe | f022ddb | 2008-06-04 19:55:58 +0200 | [diff] [blame^] | 51 | return nrand48(rs->r); |
Jens Axboe | 2c0ecd2 | 2006-06-08 13:25:41 +0200 | [diff] [blame] | 52 | } |
| 53 | |
Jens Axboe | e116f2b | 2008-06-04 15:14:24 +0200 | [diff] [blame] | 54 | #define FIO_OS_DIRECTIO |
| 55 | extern int directio(int, int); |
| 56 | static inline int fio_set_odirect(int fd) |
| 57 | { |
| 58 | if (directio(fd, DIRECTIO_ON) < 0) |
| 59 | return errno; |
| 60 | |
| 61 | return 0; |
| 62 | } |
| 63 | |
Jens Axboe | 2c0ecd2 | 2006-06-08 13:25:41 +0200 | [diff] [blame] | 64 | #endif |