blob: f4c5e235b698986e030ddc18f3dbd164ca918215 [file] [log] [blame]
Jens Axboeebac4652005-12-08 15:25:21 +01001#ifndef FIO_OS_FREEBSD_H
2#define FIO_OS_FREEBSD_H
3
Jens Axboe690dec62009-01-06 14:22:30 +01004#include <errno.h>
Jens Axboe5c4e1db2006-06-07 14:17:08 +02005#include <sys/sysctl.h>
6
Jens Axboeebac4652005-12-08 15:25:21 +01007#define FIO_HAVE_POSIXAIO
Jens Axboe2c0ecd22006-06-08 13:25:41 +02008#define FIO_HAVE_ODIRECT
Jens Axboe792d5512009-09-22 17:12:29 +02009#define FIO_USE_GENERIC_BDEV_SIZE
Jens Axboeebac4652005-12-08 15:25:21 +010010
Jens Axboedc873b62008-06-04 20:13:04 +020011#define OS_MAP_ANON MAP_ANON
Jens Axboeebac4652005-12-08 15:25:21 +010012
13typedef unsigned long os_cpu_mask_t;
Jens Axboe6dfd46b2006-06-07 13:57:06 +020014typedef unsigned int os_random_state_t;
Jens Axboeebac4652005-12-08 15:25:21 +010015
Jens Axboee5b401d2006-10-18 16:03:40 +020016static inline int blockdev_invalidate_cache(int fd)
17{
18 return EINVAL;
Jens Axboeebac4652005-12-08 15:25:21 +010019}
20
Jens Axboe32cd46a2006-06-07 13:40:40 +020021static inline unsigned long long os_phys_mem(void)
22{
23 int mib[2] = { CTL_HW, HW_PHYSMEM };
24 unsigned long long mem;
25 size_t len = sizeof(mem);
26
27 sysctl(mib, 2, &mem, &len, NULL, 0);
28 return mem;
29}
30
Jens Axboe6dfd46b2006-06-07 13:57:06 +020031static inline void os_random_seed(unsigned long seed, os_random_state_t *rs)
32{
33 srand(seed);
34}
35
36static inline long os_random_long(os_random_state_t *rs)
37{
38 long val;
39
40 val = rand_r(rs);
41 return val;
42}
43
Jens Axboea1c58072009-08-04 23:17:02 +020044#ifdef MADV_FREE
45#define FIO_MADV_FREE MADV_FREE
46#endif
47
Jens Axboeebac4652005-12-08 15:25:21 +010048#endif