1 #ifndef FIO_OS_DRAGONFLY_H
2 #define FIO_OS_DRAGONFLY_H
4 #define FIO_OS os_dragonfly
9 #include <sys/sysctl.h>
10 #include <sys/statvfs.h>
11 #include <sys/diskslice.h>
12 #include <sys/ioctl_compat.h>
16 #define FIO_HAVE_ODIRECT
17 #define FIO_USE_GENERIC_RAND
18 #define FIO_USE_GENERIC_INIT_RANDOM_STATE
19 #define FIO_HAVE_FS_STAT
21 #define FIO_HAVE_CHARDEV_SIZE
22 #define FIO_HAVE_GETTID
24 #undef FIO_HAVE_CPU_AFFINITY /* XXX notyet */
26 #define OS_MAP_ANON MAP_ANON
28 #ifndef PTHREAD_STACK_MIN
29 #define PTHREAD_STACK_MIN 4096
32 #define fio_swap16(x) bswap16(x)
33 #define fio_swap32(x) bswap32(x)
34 #define fio_swap64(x) bswap64(x)
36 typedef off_t off64_t;
38 static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
42 if (!ioctl(f->fd, DIOCGPART, &pi)) {
43 *bytes = (unsigned long long) pi.media_size;
51 static inline int chardev_size(struct fio_file *f, unsigned long long *bytes)
53 return blockdev_size(f, bytes);
56 static inline int blockdev_invalidate_cache(struct fio_file *f)
61 static inline unsigned long long os_phys_mem(void)
63 int mib[2] = { CTL_HW, HW_PHYSMEM };
65 size_t len = sizeof(mem);
67 sysctl(mib, 2, &mem, &len, NULL, 0);
71 static inline int gettid(void)
73 return (int) lwp_gettid();
76 static inline unsigned long long get_fs_free_size(const char *path)
78 unsigned long long ret;
81 if (statvfs(path, &s) < 0)
85 ret *= (unsigned long long) s.f_bfree;
89 static inline int os_trim(int fd, unsigned long long start,
90 unsigned long long len)
97 if (!ioctl(fd, IOCTLTRIM, range))
104 #define FIO_MADV_FREE MADV_FREE