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 /* XXX hack to avoid confilcts between rbtree.h and <sys/rb.h> */
14 #define rb_node _rb_node
15 #include <sys/sysctl.h>
22 #define FIO_HAVE_ODIRECT
23 #define FIO_USE_GENERIC_RAND
24 #define FIO_USE_GENERIC_INIT_RANDOM_STATE
25 #define FIO_HAVE_FS_STAT
26 #define FIO_HAVE_GETTID
28 #undef FIO_HAVE_CPU_AFFINITY /* doesn't exist */
30 #define OS_MAP_ANON MAP_ANON
32 #ifndef PTHREAD_STACK_MIN
33 #define PTHREAD_STACK_MIN 4096
36 #define fio_swap16(x) bswap16(x)
37 #define fio_swap32(x) bswap32(x)
38 #define fio_swap64(x) bswap64(x)
40 typedef off_t off64_t;
42 static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
46 if (!ioctl(f->fd, DIOCGDINFO, &dl)) {
47 *bytes = ((unsigned long long)dl.d_secperunit) * dl.d_secsize;
55 static inline int blockdev_invalidate_cache(struct fio_file *f)
60 static inline unsigned long long os_phys_mem(void)
62 int mib[2] = { CTL_HW, HW_PHYSMEM64 };
64 size_t len = sizeof(mem);
66 sysctl(mib, 2, &mem, &len, NULL, 0);
70 static inline int gettid(void)
72 return (int) _lwp_self();
75 static inline unsigned long long get_fs_free_size(const char *path)
77 unsigned long long ret;
80 if (statvfs(path, &s) < 0)
84 ret *= (unsigned long long) s.f_bfree;
89 #define FIO_MADV_FREE MADV_FREE