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/endian.h>
11 #include <sys/socket.h>
15 #define FIO_HAVE_POSIXAIO
16 #define FIO_HAVE_ODIRECT
17 #define FIO_HAVE_STRSEP
18 #define FIO_USE_GENERIC_RAND
19 #define FIO_USE_GENERIC_INIT_RANDOM_STATE
20 #define FIO_HAVE_CHARDEV_SIZE
21 #define FIO_HAVE_GETTID
22 #define FIO_HAVE_CLOCK_MONOTONIC
24 #define OS_MAP_ANON MAP_ANON
26 #if BYTE_ORDER == LITTLE_ENDIAN
27 #define FIO_LITTLE_ENDIAN
29 #define FIO_BIG_ENDIAN
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, DIOCGMEDIASIZE, &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 };
64 unsigned long long mem;
65 size_t len = sizeof(mem);
67 sysctl(mib, 2, &mem, &len, NULL, 0);
71 static inline int gettid(void)
80 #define FIO_MADV_FREE MADV_FREE