ae905169cc720a33b90c4f2a47abfd8a045f59dc
[fio.git] / os / os-solaris.h
1 #ifndef FIO_OS_SOLARIS_H
2 #define FIO_OS_SOLARIS_H
3
4 #undef FIO_HAVE_LIBAIO
5 #define FIO_HAVE_POSIXAIO
6 #define FIO_HAVE_SOLARISAIO
7 #undef FIO_HAVE_FADVISE
8 #undef FIO_HAVE_CPU_AFFINITY
9 #undef FIO_HAVE_DISK_UTIL
10 #undef FIO_HAVE_SGIO
11 #undef FIO_HAVE_ODIRECT
12 #define FIO_HAVE_FALLOCATE
13
14 #define OS_MAP_ANON             (MAP_ANON)
15
16 typedef unsigned long os_cpu_mask_t;
17 typedef unsigned int os_random_state_t;
18
19 /*
20  * FIXME
21  */
22 static inline int blockdev_size(int fd, unsigned long long *bytes)
23 {
24         return EINVAL;
25 }
26
27 static inline int blockdev_invalidate_cache(int fd)
28 {
29         return EINVAL;
30 }
31
32 static inline unsigned long long os_phys_mem(void)
33 {
34 #if 0
35         int mib[2] = { CTL_HW, HW_PHYSMEM };
36         unsigned long long mem;
37         size_t len = sizeof(mem);
38
39         sysctl(mib, 2, &mem, &len, NULL, 0);
40         return mem;
41 #else
42         return 0;
43 #endif
44 }
45
46 static inline void os_random_seed(unsigned long seed, os_random_state_t *rs)
47 {
48         srand(seed);
49 }
50
51 static inline long os_random_long(os_random_state_t *rs)
52 {
53         long val;
54
55         val = rand_r(rs);
56         return val;
57 }
58
59 #endif