blob: 4b0269e6cab673311576689d514db5b09d49d822 [file] [log] [blame]
Jens Axboec50bdd82010-05-21 07:14:04 +02001#ifndef FIO_OS_NETBSD_H
2#define FIO_OS_NETBSD_H
3
Jens Axboecca84642011-10-07 12:47:57 +02004#define FIO_OS os_netbsd
5
Jens Axboec50bdd82010-05-21 07:14:04 +02006#include <errno.h>
Roger Pau Monne12ae1be2012-09-26 12:42:35 +02007#include <lwp.h>
Jens Axboec50bdd82010-05-21 07:14:04 +02008#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
Jens Axboee2e58882011-01-04 08:36:06 +010016#include "../file.h"
17
Jens Axboec50bdd82010-05-21 07:14:04 +020018#define FIO_HAVE_ODIRECT
Jens Axboec50bdd82010-05-21 07:14:04 +020019#define FIO_USE_GENERIC_BDEV_SIZE
20#define FIO_USE_GENERIC_RAND
Bruce Cran93bcfd22012-02-20 20:18:19 +010021#define FIO_USE_GENERIC_INIT_RANDOM_STATE
Jens Axboeb9afd952011-07-12 23:49:16 +020022#define FIO_HAVE_GETTID
Jens Axboec50bdd82010-05-21 07:14:04 +020023
24#undef FIO_HAVE_CPU_AFFINITY /* XXX notyet */
25
26#define OS_MAP_ANON MAP_ANON
27
Bruce Cran9b836562011-01-08 19:49:54 +010028#ifndef PTHREAD_STACK_MIN
29#define PTHREAD_STACK_MIN 4096
30#endif
31
Jens Axboe901ebe12011-10-04 23:31:00 +020032#define fio_swap16(x) bswap16(x)
33#define fio_swap32(x) bswap32(x)
34#define fio_swap64(x) bswap64(x)
35
Jens Axboec50bdd82010-05-21 07:14:04 +020036typedef off_t off64_t;
37
Bruce Cran9b836562011-01-08 19:49:54 +010038static inline int blockdev_invalidate_cache(struct fio_file *f)
Jens Axboec50bdd82010-05-21 07:14:04 +020039{
40 return EINVAL;
41}
42
43static 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
Jens Axboeb9afd952011-07-12 23:49:16 +020053static inline int gettid(void)
54{
Roger Pau Monne12ae1be2012-09-26 12:42:35 +020055 return (int) _lwp_self();
Jens Axboeb9afd952011-07-12 23:49:16 +020056}
57
Jens Axboec50bdd82010-05-21 07:14:04 +020058#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