7f5f48466b3f9ab8c9c4552160592b542f7cdc49
[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 #include "../file.h"
14
15 #define FIO_HAVE_POSIXAIO
16 #define FIO_HAVE_FADVISE
17 #define FIO_HAVE_ODIRECT
18 #define FIO_HAVE_STRSEP
19 #define FIO_HAVE_FDATASYNC
20 #define FIO_USE_GENERIC_BDEV_SIZE
21 #define FIO_USE_GENERIC_RAND
22 #define FIO_HAVE_GETTID
23
24 #undef  FIO_HAVE_CPU_AFFINITY   /* XXX notyet */
25
26 #define OS_MAP_ANON             MAP_ANON
27
28 #ifndef PTHREAD_STACK_MIN
29 #define PTHREAD_STACK_MIN 4096
30 #endif
31
32 typedef off_t off64_t;
33
34 static inline int blockdev_invalidate_cache(struct fio_file *f)
35 {
36         return EINVAL;
37 }
38
39 static inline unsigned long long os_phys_mem(void)
40 {
41         int mib[2] = { CTL_HW, HW_PHYSMEM64 };
42         uint64_t mem;
43         size_t len = sizeof(mem);
44
45         sysctl(mib, 2, &mem, &len, NULL, 0);
46         return mem;
47 }
48
49 static inline int gettid(void)
50 {
51         long lwpid;
52
53         thr_self(&lwpid);
54         return (int) lwpid;
55 }
56
57 #ifdef MADV_FREE
58 #define FIO_MADV_FREE   MADV_FREE
59 #endif
60
61 /* XXX NetBSD doesn't have getopt_long_only */
62 #define getopt_long_only        getopt_long
63
64 #endif