blob: 3939d65254ab81edf7e4a06abdcf4399bdccdbf9 [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 Axboeebac4652005-12-08 15:25:21 +01009
Jens Axboedc873b62008-06-04 20:13:04 +020010#define OS_MAP_ANON MAP_ANON
Jens Axboeebac4652005-12-08 15:25:21 +010011
12typedef unsigned long os_cpu_mask_t;
Jens Axboe6dfd46b2006-06-07 13:57:06 +020013typedef unsigned int os_random_state_t;
Jens Axboeebac4652005-12-08 15:25:21 +010014
15/*
16 * FIXME
17 */
Jens Axboe9104f872005-12-28 23:50:45 +010018static inline int blockdev_size(int fd, unsigned long long *bytes)
Jens Axboeebac4652005-12-08 15:25:21 +010019{
Jens Axboee5b401d2006-10-18 16:03:40 +020020 return EINVAL;
21}
22
23static inline int blockdev_invalidate_cache(int fd)
24{
25 return EINVAL;
Jens Axboeebac4652005-12-08 15:25:21 +010026}
27
Jens Axboe32cd46a2006-06-07 13:40:40 +020028static inline unsigned long long os_phys_mem(void)
29{
30 int mib[2] = { CTL_HW, HW_PHYSMEM };
31 unsigned long long mem;
32 size_t len = sizeof(mem);
33
34 sysctl(mib, 2, &mem, &len, NULL, 0);
35 return mem;
36}
37
Jens Axboe6dfd46b2006-06-07 13:57:06 +020038static inline void os_random_seed(unsigned long seed, os_random_state_t *rs)
39{
40 srand(seed);
41}
42
43static inline long os_random_long(os_random_state_t *rs)
44{
45 long val;
46
47 val = rand_r(rs);
48 return val;
49}
50
Jens Axboeebac4652005-12-08 15:25:21 +010051#endif