70d2958b47d2695a46c055cc169e2e7eeed50685
[fio.git] / os / os-netbsd.h
1 #ifndef FIO_OS_NETBSD_H
2 #define FIO_OS_NETBSD_H
3
4 #include <errno.h>
5 #include <sys/param.h>
6 /* XXX hack to avoid confilcts between rbtree.h and <sys/rb.h> */
7 #define rb_node _rb_node
8 #include <sys/sysctl.h>
9 #undef rb_node
10 #undef rb_left
11 #undef rb_right
12
13 #define FIO_HAVE_POSIXAIO
14 #define FIO_HAVE_FADVISE
15 #define fadvise posix_fadvise   /* XXX NetBSD doesn't have fadvise */
16 #define FIO_HAVE_ODIRECT
17 #define FIO_HAVE_STRSEP
18 #define FIO_HAVE_FDATASYNC
19 #define FIO_USE_GENERIC_BDEV_SIZE
20 #define FIO_USE_GENERIC_RAND
21
22 #undef  FIO_HAVE_CPU_AFFINITY   /* XXX notyet */
23
24 #define OS_MAP_ANON             MAP_ANON
25
26 typedef off_t off64_t;
27
28 static inline int blockdev_invalidate_cache(int fd)
29 {
30         return EINVAL;
31 }
32
33 static inline unsigned long long os_phys_mem(void)
34 {
35         int mib[2] = { CTL_HW, HW_PHYSMEM64 };
36         uint64_t mem;
37         size_t len = sizeof(mem);
38
39         sysctl(mib, 2, &mem, &len, NULL, 0);
40         return mem;
41 }
42
43 #ifdef MADV_FREE
44 #define FIO_MADV_FREE   MADV_FREE
45 #endif
46
47 /* XXX NetBSD doesn't have getopt_long_only */
48 #define getopt_long_only        getopt_long
49
50 #endif