Add basic DragonFly support
[fio.git] / os / os-dragonfly.h
CommitLineData
239b2882
JA
1#ifndef FIO_OS_DRAGONFLY_H
2#define FIO_OS_DRAGONFLY_H
3
4#define FIO_OS os_dragonfly
5
6#include <errno.h>
7#include <sys/param.h>
8/* XXX hack to avoid confilcts between rbtree.h and <sys/rb.h> */
9#define rb_node _rb_node
10#include <sys/sysctl.h>
11#undef rb_node
12#undef rb_left
13#undef rb_right
14
15#include "../file.h"
16
17#define FIO_HAVE_ODIRECT
18#define FIO_USE_GENERIC_BDEV_SIZE
19#define FIO_USE_GENERIC_RAND
20#define FIO_USE_GENERIC_INIT_RANDOM_STATE
21#define FIO_HAVE_GETTID
22
23#undef FIO_HAVE_CPU_AFFINITY /* XXX notyet */
24
25#define OS_MAP_ANON MAP_ANON
26
27#ifndef PTHREAD_STACK_MIN
28#define PTHREAD_STACK_MIN 4096
29#endif
30
31#define fio_swap16(x) bswap16(x)
32#define fio_swap32(x) bswap32(x)
33#define fio_swap64(x) bswap64(x)
34
35typedef off_t off64_t;
36
37static inline int blockdev_invalidate_cache(struct fio_file *f)
38{
39 return EINVAL;
40}
41
42static inline unsigned long long os_phys_mem(void)
43{
44 int mib[2] = { CTL_HW, HW_PHYSMEM };
45 uint64_t mem;
46 size_t len = sizeof(mem);
47
48 sysctl(mib, 2, &mem, &len, NULL, 0);
49 return mem;
50}
51
52static inline int gettid(void)
53{
54 return (int) lwp_gettid();
55}
56
57#ifdef MADV_FREE
58#define FIO_MADV_FREE MADV_FREE
59#endif
60
61#endif