1 #ifndef FIO_OS_NETBSD_H
2 #define FIO_OS_NETBSD_H
4 #define FIO_OS os_netbsd
9 #include <sys/statvfs.h>
10 #include <sys/ioctl.h>
12 #include <sys/disklabel.h>
13 #include <sys/endian.h>
14 #include <sys/sysctl.h>
16 /* XXX hack to avoid confilcts between rbtree.h and <sys/rbtree.h> */
23 #define FIO_HAVE_ODIRECT
24 #define FIO_USE_GENERIC_INIT_RANDOM_STATE
25 #define FIO_HAVE_FS_STAT
26 #define FIO_HAVE_GETTID
28 #define OS_MAP_ANON MAP_ANON
30 #ifndef PTHREAD_STACK_MIN
31 #define PTHREAD_STACK_MIN 4096
34 #define fio_swap16(x) bswap16(x)
35 #define fio_swap32(x) bswap32(x)
36 #define fio_swap64(x) bswap64(x)
38 static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
42 if (!ioctl(f->fd, DIOCGDINFO, &dl)) {
43 *bytes = ((unsigned long long)dl.d_secperunit) * dl.d_secsize;
51 static inline int blockdev_invalidate_cache(struct fio_file *f)
56 static inline unsigned long long os_phys_mem(void)
58 int mib[2] = { CTL_HW, HW_PHYSMEM64 };
60 size_t len = sizeof(mem);
62 sysctl(mib, 2, &mem, &len, NULL, 0);
66 #ifndef CONFIG_HAVE_GETTID
67 static inline int gettid(void)
69 return (int) _lwp_self();
73 static inline unsigned long long get_fs_free_size(const char *path)
75 unsigned long long ret;
78 if (statvfs(path, &s) < 0)
82 ret *= (unsigned long long) s.f_bfree;
87 #define FIO_MADV_FREE MADV_FREE