Commit | Line | Data |
---|---|---|
c50bdd8f JA |
1 | #ifndef FIO_OS_NETBSD_H |
2 | #define FIO_OS_NETBSD_H | |
3 | ||
cca84643 JA |
4 | #define FIO_OS os_netbsd |
5 | ||
c50bdd8f | 6 | #include <errno.h> |
12ae1bee | 7 | #include <lwp.h> |
c50bdd8f JA |
8 | #include <sys/param.h> |
9 | /* XXX hack to avoid confilcts between rbtree.h and <sys/rb.h> */ | |
10 | #define rb_node _rb_node | |
11 | #include <sys/sysctl.h> | |
12 | #undef rb_node | |
13 | #undef rb_left | |
14 | #undef rb_right | |
15 | ||
e2e58886 JA |
16 | #include "../file.h" |
17 | ||
c50bdd8f | 18 | #define FIO_HAVE_ODIRECT |
c50bdd8f JA |
19 | #define FIO_USE_GENERIC_BDEV_SIZE |
20 | #define FIO_USE_GENERIC_RAND | |
93bcfd20 | 21 | #define FIO_USE_GENERIC_INIT_RANDOM_STATE |
b9afd959 | 22 | #define FIO_HAVE_GETTID |
c50bdd8f JA |
23 | |
24 | #undef FIO_HAVE_CPU_AFFINITY /* XXX notyet */ | |
25 | ||
26 | #define OS_MAP_ANON MAP_ANON | |
27 | ||
9b836561 BC |
28 | #ifndef PTHREAD_STACK_MIN |
29 | #define PTHREAD_STACK_MIN 4096 | |
30 | #endif | |
31 | ||
901ebe18 JA |
32 | #define fio_swap16(x) bswap16(x) |
33 | #define fio_swap32(x) bswap32(x) | |
34 | #define fio_swap64(x) bswap64(x) | |
35 | ||
c50bdd8f JA |
36 | typedef off_t off64_t; |
37 | ||
9b836561 | 38 | static inline int blockdev_invalidate_cache(struct fio_file *f) |
c50bdd8f JA |
39 | { |
40 | return EINVAL; | |
41 | } | |
42 | ||
43 | static inline unsigned long long os_phys_mem(void) | |
44 | { | |
45 | int mib[2] = { CTL_HW, HW_PHYSMEM64 }; | |
46 | uint64_t mem; | |
47 | size_t len = sizeof(mem); | |
48 | ||
49 | sysctl(mib, 2, &mem, &len, NULL, 0); | |
50 | return mem; | |
51 | } | |
52 | ||
b9afd959 JA |
53 | static inline int gettid(void) |
54 | { | |
12ae1bee | 55 | return (int) _lwp_self(); |
b9afd959 JA |
56 | } |
57 | ||
c50bdd8f JA |
58 | #ifdef MADV_FREE |
59 | #define FIO_MADV_FREE MADV_FREE | |
60 | #endif | |
61 | ||
62 | /* XXX NetBSD doesn't have getopt_long_only */ | |
63 | #define getopt_long_only getopt_long | |
64 | ||
65 | #endif |