• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef FIO_OS_OPENBSD_H
2 #define FIO_OS_OPENBSD_H
3 
4 #define	FIO_OS	os_openbsd
5 
6 #include <errno.h>
7 #include <sys/param.h>
8 /* XXX hack to avoid conflicts between rbtree.h and <sys/tree.h> */
9 #include <sys/sysctl.h>
10 #undef RB_BLACK
11 #undef RB_RED
12 #undef RB_ROOT
13 
14 #include "../file.h"
15 
16 #undef  FIO_HAVE_ODIRECT
17 #define FIO_USE_GENERIC_BDEV_SIZE
18 #define FIO_USE_GENERIC_RAND
19 #define FIO_USE_GENERIC_INIT_RANDOM_STATE
20 #define FIO_HAVE_GETTID
21 
22 #undef	FIO_HAVE_CPU_AFFINITY	/* XXX notyet */
23 
24 #define OS_MAP_ANON		MAP_ANON
25 
26 #ifndef PTHREAD_STACK_MIN
27 #define PTHREAD_STACK_MIN 4096
28 #endif
29 
30 #define fio_swap16(x)	bswap16(x)
31 #define fio_swap32(x)	bswap32(x)
32 #define fio_swap64(x)	bswap64(x)
33 
34 typedef off_t off64_t;
35 
blockdev_invalidate_cache(struct fio_file * f)36 static inline int blockdev_invalidate_cache(struct fio_file *f)
37 {
38 	return EINVAL;
39 }
40 
os_phys_mem(void)41 static inline unsigned long long os_phys_mem(void)
42 {
43 	int mib[2] = { CTL_HW, HW_PHYSMEM64 };
44 	uint64_t mem;
45 	size_t len = sizeof(mem);
46 
47 	sysctl(mib, 2, &mem, &len, NULL, 0);
48 	return mem;
49 }
50 
gettid(void)51 static inline int gettid(void)
52 {
53 	return (int) pthread_self();
54 }
55 
56 #ifdef MADV_FREE
57 #define FIO_MADV_FREE	MADV_FREE
58 #endif
59 
60 #endif
61