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