1 #ifndef FIO_OS_SOLARIS_H
2 #define FIO_OS_SOLARIS_H
14 #define FIO_HAVE_POSIXAIO
15 #define FIO_HAVE_SOLARISAIO
16 #define FIO_HAVE_POSIXAIO_FSYNC
17 #define FIO_HAVE_CPU_AFFINITY
18 #define FIO_HAVE_PSHARED_MUTEX
19 #define FIO_HAVE_FDATASYNC
20 #define FIO_HAVE_CHARDEV_SIZE
21 #define FIO_USE_GENERIC_BDEV_SIZE
22 #define FIO_HAVE_GETTID
24 #define OS_MAP_ANON MAP_ANON
25 #define OS_RAND_MAX 2147483648UL
27 struct solaris_rand_seed {
31 #ifndef POSIX_MADV_SEQUENTIAL
32 #define posix_madvise madvise
33 #define POSIX_MADV_SEQUENTIAL MADV_SEQUENTIAL
34 #define POSIX_MADV_DONTNEED MADV_DONTNEED
35 #define POSIX_MADV_RANDOM MADV_RANDOM
38 typedef psetid_t os_cpu_mask_t;
39 typedef struct solaris_rand_seed os_random_state_t;
41 static inline int chardev_size(struct fio_file *f, unsigned long long *bytes)
47 if (ioctl(f->fd, DKIOCGMEDIAINFO, &info) < 0)
50 *bytes = info.dki_lbsize * info.dki_capacity;
54 static inline int blockdev_invalidate_cache(struct fio_file *f)
59 static inline unsigned long long os_phys_mem(void)
64 static inline void os_random_seed(unsigned long seed, os_random_state_t *rs)
66 rs->r[0] = seed & 0xffff;
68 rs->r[1] = seed & 0xffff;
70 rs->r[2] = seed & 0xffff;
74 static inline long os_random_long(os_random_state_t *rs)
76 return nrand48(rs->r);
79 #define FIO_OS_DIRECTIO
80 extern int directio(int, int);
81 static inline int fio_set_odirect(int fd)
83 if (directio(fd, DIRECTIO_ON) < 0)
90 * pset binding hooks for fio
92 #define fio_setaffinity(pid, cpumask) \
93 pset_bind((cpumask), P_PID, (pid), NULL)
94 #define fio_getaffinity(pid, ptr) ({ 0; })
96 #define fio_cpu_clear(mask, cpu) pset_assign(PS_NONE, (cpu), NULL)
97 #define fio_cpu_set(mask, cpu) pset_assign(*(mask), (cpu), NULL)
99 static inline int fio_cpuset_init(os_cpu_mask_t *mask)
103 if (pset_create(mask) < 0) {
111 static inline int fio_cpuset_exit(os_cpu_mask_t *mask)
115 if (pset_destroy(*mask) < 0) {
123 static inline int gettid(void)
125 return pthread_self();
129 * Should be enough, not aware of what (if any) restrictions Solaris has
131 #define FIO_MAX_CPUS 16384
134 #define FIO_MADV_FREE MADV_FREE