1 #ifndef FIO_OS_FREEBSD_H
2 #define FIO_OS_FREEBSD_H
4 #define FIO_OS os_freebsd
7 #include <sys/sysctl.h>
10 #include <sys/socket.h>
14 #define FIO_HAVE_ODIRECT
15 #define FIO_USE_GENERIC_RAND
16 #define FIO_USE_GENERIC_INIT_RANDOM_STATE
17 #define FIO_HAVE_CHARDEV_SIZE
18 #define FIO_HAVE_GETTID
20 #define OS_MAP_ANON MAP_ANON
22 #define fio_swap16(x) bswap16(x)
23 #define fio_swap32(x) bswap32(x)
24 #define fio_swap64(x) bswap64(x)
26 typedef off_t off64_t;
28 static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
32 if (!ioctl(f->fd, DIOCGMEDIASIZE, &size)) {
41 static inline int chardev_size(struct fio_file *f, unsigned long long *bytes)
43 return blockdev_size(f, bytes);
46 static inline int blockdev_invalidate_cache(struct fio_file *f)
51 static inline unsigned long long os_phys_mem(void)
53 int mib[2] = { CTL_HW, HW_PHYSMEM };
54 unsigned long long mem;
55 size_t len = sizeof(mem);
57 sysctl(mib, 2, &mem, &len, NULL, 0);
61 static inline int gettid(void)
70 #define FIO_MADV_FREE MADV_FREE