blob: 759f3c1bc2cdfb33018504716cb0163e5ecf0531 [file] [log] [blame]
Jens Axboe2c0ecd22006-06-08 13:25:41 +02001#ifndef FIO_OS_SOLARIS_H
2#define FIO_OS_SOLARIS_H
3
Jens Axboee116f2b2008-06-04 15:14:24 +02004#include <sys/types.h>
5#include <sys/fcntl.h>
6
Jens Axboe2c0ecd22006-06-08 13:25:41 +02007#define FIO_HAVE_POSIXAIO
Jens Axboe417f0062008-06-02 11:59:30 +02008#define FIO_HAVE_SOLARISAIO
Jens Axboefffca022008-06-02 12:23:40 +02009#define FIO_HAVE_FALLOCATE
Jens Axboe207cb0f2008-06-02 12:28:02 +020010#define FIO_HAVE_POSIXAIO_FSYNC
Jens Axboe2c0ecd22006-06-08 13:25:41 +020011
Jens Axboedc873b62008-06-04 20:13:04 +020012#define OS_MAP_ANON MAP_ANON
13#define OS_RAND_MAX 2147483648UL
Jens Axboe2c0ecd22006-06-08 13:25:41 +020014
Jens Axboef022ddb2008-06-04 19:55:58 +020015struct solaris_rand_seed {
16 unsigned short r[3];
17};
18
Jens Axboe2c0ecd22006-06-08 13:25:41 +020019typedef unsigned long os_cpu_mask_t;
Jens Axboef022ddb2008-06-04 19:55:58 +020020typedef struct solaris_rand_seed os_random_state_t;
Jens Axboe2c0ecd22006-06-08 13:25:41 +020021
22/*
23 * FIXME
24 */
25static inline int blockdev_size(int fd, unsigned long long *bytes)
26{
Jens Axboee5b401d2006-10-18 16:03:40 +020027 return EINVAL;
28}
29
30static inline int blockdev_invalidate_cache(int fd)
31{
32 return EINVAL;
Jens Axboe2c0ecd22006-06-08 13:25:41 +020033}
34
35static inline unsigned long long os_phys_mem(void)
36{
Jens Axboe2c0ecd22006-06-08 13:25:41 +020037 return 0;
Jens Axboe2c0ecd22006-06-08 13:25:41 +020038}
39
40static inline void os_random_seed(unsigned long seed, os_random_state_t *rs)
41{
Jens Axboef022ddb2008-06-04 19:55:58 +020042 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 Axboe2c0ecd22006-06-08 13:25:41 +020048}
49
50static inline long os_random_long(os_random_state_t *rs)
51{
Jens Axboef022ddb2008-06-04 19:55:58 +020052 return nrand48(rs->r);
Jens Axboe2c0ecd22006-06-08 13:25:41 +020053}
54
Jens Axboee116f2b2008-06-04 15:14:24 +020055#define FIO_OS_DIRECTIO
56extern int directio(int, int);
57static 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 Axboe2c0ecd22006-06-08 13:25:41 +020065#endif