Commit | Line | Data |
---|---|---|
2c0ecd28 JA |
1 | #ifndef FIO_OS_SOLARIS_H |
2 | #define FIO_OS_SOLARIS_H | |
3 | ||
e116f2b9 JA |
4 | #include <sys/types.h> |
5 | #include <sys/fcntl.h> | |
6 | ||
2c0ecd28 | 7 | #define FIO_HAVE_POSIXAIO |
417f0068 | 8 | #define FIO_HAVE_SOLARISAIO |
fffca02d | 9 | #define FIO_HAVE_FALLOCATE |
207cb0f0 | 10 | #define FIO_HAVE_POSIXAIO_FSYNC |
2c0ecd28 JA |
11 | |
12 | #define OS_MAP_ANON (MAP_ANON) | |
13 | ||
14 | typedef unsigned long os_cpu_mask_t; | |
15 | typedef unsigned int os_random_state_t; | |
16 | ||
17 | /* | |
18 | * FIXME | |
19 | */ | |
20 | static inline int blockdev_size(int fd, unsigned long long *bytes) | |
21 | { | |
e5b401d4 JA |
22 | return EINVAL; |
23 | } | |
24 | ||
25 | static inline int blockdev_invalidate_cache(int fd) | |
26 | { | |
27 | return EINVAL; | |
2c0ecd28 JA |
28 | } |
29 | ||
30 | static inline unsigned long long os_phys_mem(void) | |
31 | { | |
32 | #if 0 | |
33 | int mib[2] = { CTL_HW, HW_PHYSMEM }; | |
34 | unsigned long long mem; | |
35 | size_t len = sizeof(mem); | |
36 | ||
37 | sysctl(mib, 2, &mem, &len, NULL, 0); | |
38 | return mem; | |
39 | #else | |
40 | return 0; | |
41 | #endif | |
42 | } | |
43 | ||
44 | static inline void os_random_seed(unsigned long seed, os_random_state_t *rs) | |
45 | { | |
46 | srand(seed); | |
47 | } | |
48 | ||
49 | static inline long os_random_long(os_random_state_t *rs) | |
50 | { | |
51 | long val; | |
52 | ||
53 | val = rand_r(rs); | |
54 | return val; | |
55 | } | |
56 | ||
e116f2b9 JA |
57 | #define FIO_OS_DIRECTIO |
58 | extern int directio(int, int); | |
59 | static inline int fio_set_odirect(int fd) | |
60 | { | |
61 | if (directio(fd, DIRECTIO_ON) < 0) | |
62 | return errno; | |
63 | ||
64 | return 0; | |
65 | } | |
66 | ||
2c0ecd28 | 67 | #endif |