Pass arch/os in probe
[fio.git] / os / os-netbsd.h
1 #ifndef FIO_OS_NETBSD_H
2 #define FIO_OS_NETBSD_H
3
4 #define FIO_OS  os_netbsd
5
6 #include <errno.h>
7 #include <sys/param.h>
8 #include <sys/thr.h>
9 #include <sys/endian.h>
10 /* XXX hack to avoid confilcts between rbtree.h and <sys/rb.h> */
11 #define rb_node _rb_node
12 #include <sys/sysctl.h>
13 #undef rb_node
14 #undef rb_left
15 #undef rb_right
16
17 #include "../file.h"
18
19 #define FIO_HAVE_POSIXAIO
20 #define FIO_HAVE_FADVISE
21 #define FIO_HAVE_ODIRECT
22 #define FIO_HAVE_STRSEP
23 #define FIO_HAVE_FDATASYNC
24 #define FIO_USE_GENERIC_BDEV_SIZE
25 #define FIO_USE_GENERIC_RAND
26 #define FIO_HAVE_GETTID
27
28 #undef  FIO_HAVE_CPU_AFFINITY   /* XXX notyet */
29
30 #define OS_MAP_ANON             MAP_ANON
31
32 #ifndef PTHREAD_STACK_MIN
33 #define PTHREAD_STACK_MIN 4096
34 #endif
35
36 #if BYTE_ORDER == LITTLE_ENDIAN
37 #define FIO_LITTLE_ENDIAN
38 #else
39 #define FIO_BIG_ENDIAN
40 #endif
41
42 #define fio_swap16(x)   bswap16(x)
43 #define fio_swap32(x)   bswap32(x)
44 #define fio_swap64(x)   bswap64(x)
45
46 typedef off_t off64_t;
47
48 static inline int blockdev_invalidate_cache(struct fio_file *f)
49 {
50         return EINVAL;
51 }
52
53 static inline unsigned long long os_phys_mem(void)
54 {
55         int mib[2] = { CTL_HW, HW_PHYSMEM64 };
56         uint64_t mem;
57         size_t len = sizeof(mem);
58
59         sysctl(mib, 2, &mem, &len, NULL, 0);
60         return mem;
61 }
62
63 static inline int gettid(void)
64 {
65         long lwpid;
66
67         thr_self(&lwpid);
68         return (int) lwpid;
69 }
70
71 #ifdef MADV_FREE
72 #define FIO_MADV_FREE   MADV_FREE
73 #endif
74
75 /* XXX NetBSD doesn't have getopt_long_only */
76 #define getopt_long_only        getopt_long
77
78 #endif