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
23 #define OS_MAP_ANON MAP_ANON
24 #define OS_RAND_MAX 2147483648UL
26 struct solaris_rand_seed {
30 #ifndef POSIX_MADV_SEQUENTIAL
31 #define posix_madvise madvise
32 #define POSIX_MADV_SEQUENTIAL MADV_SEQUENTIAL
33 #define POSIX_MADV_DONTNEED MADV_DONTNEED
34 #define POSIX_MADV_RANDOM MADV_RANDOM
37 typedef psetid_t os_cpu_mask_t;
38 typedef struct solaris_rand_seed os_random_state_t;
40 static inline int chardev_size(struct fio_file *f, unsigned long long *bytes)
46 if (ioctl(f->fd, DKIOCGMEDIAINFO, &info) < 0)
49 *bytes = info.dki_lbsize * info.dki_capacity;
53 static inline int blockdev_invalidate_cache(struct fio_file *f)
58 static inline unsigned long long os_phys_mem(void)
63 static inline void os_random_seed(unsigned long seed, os_random_state_t *rs)
65 rs->r[0] = seed & 0xffff;
67 rs->r[1] = seed & 0xffff;
69 rs->r[2] = seed & 0xffff;
73 static inline long os_random_long(os_random_state_t *rs)
75 return nrand48(rs->r);
78 #define FIO_OS_DIRECTIO
79 extern int directio(int, int);
80 static inline int fio_set_odirect(int fd)
82 if (directio(fd, DIRECTIO_ON) < 0)
89 * pset binding hooks for fio
91 #define fio_setaffinity(pid, cpumask) \
92 pset_bind((cpumask), P_PID, (pid), NULL)
93 #define fio_getaffinity(pid, ptr) ({ 0; })
95 #define fio_cpu_clear(mask, cpu) pset_assign(PS_NONE, (cpu), NULL)
96 #define fio_cpu_set(mask, cpu) pset_assign(*(mask), (cpu), NULL)
98 static inline int fio_cpuset_init(os_cpu_mask_t *mask)
102 if (pset_create(mask) < 0) {
110 static inline int fio_cpuset_exit(os_cpu_mask_t *mask)
114 if (pset_destroy(*mask) < 0) {
123 * Should be enough, not aware of what (if any) restrictions Solaris has
125 #define FIO_MAX_CPUS 16384
128 #define FIO_MADV_FREE MADV_FREE