blob: 614296a4bc8744e8d4395a8abe9ef40eeb89f8d4 [file] [log] [blame]
Jens Axboeebac4652005-12-08 15:25:21 +01001#ifndef FIO_OS_FREEBSD_H
2#define FIO_OS_FREEBSD_H
3
Jens Axboe5c4e1db2006-06-07 14:17:08 +02004#include <sys/sysctl.h>
5
Jens Axboeebac4652005-12-08 15:25:21 +01006#define FIO_HAVE_POSIXAIO
Jens Axboe2c0ecd22006-06-08 13:25:41 +02007#define FIO_HAVE_ODIRECT
Jens Axboeebac4652005-12-08 15:25:21 +01008
Jens Axboedc873b62008-06-04 20:13:04 +02009#define OS_MAP_ANON MAP_ANON
Jens Axboeebac4652005-12-08 15:25:21 +010010
11typedef unsigned long os_cpu_mask_t;
Jens Axboe6dfd46b2006-06-07 13:57:06 +020012typedef unsigned int os_random_state_t;
Jens Axboeebac4652005-12-08 15:25:21 +010013
14/*
15 * FIXME
16 */
Jens Axboe9104f872005-12-28 23:50:45 +010017static inline int blockdev_size(int fd, unsigned long long *bytes)
Jens Axboeebac4652005-12-08 15:25:21 +010018{
Jens Axboee5b401d2006-10-18 16:03:40 +020019 return EINVAL;
20}
21
22static inline int blockdev_invalidate_cache(int fd)
23{
24 return EINVAL;
Jens Axboeebac4652005-12-08 15:25:21 +010025}
26
Jens Axboe32cd46a2006-06-07 13:40:40 +020027static inline unsigned long long os_phys_mem(void)
28{
29 int mib[2] = { CTL_HW, HW_PHYSMEM };
30 unsigned long long mem;
31 size_t len = sizeof(mem);
32
33 sysctl(mib, 2, &mem, &len, NULL, 0);
34 return mem;
35}
36
Jens Axboe6dfd46b2006-06-07 13:57:06 +020037static inline void os_random_seed(unsigned long seed, os_random_state_t *rs)
38{
39 srand(seed);
40}
41
42static inline long os_random_long(os_random_state_t *rs)
43{
44 long val;
45
46 val = rand_r(rs);
47 return val;
48}
49
Jens Axboeebac4652005-12-08 15:25:21 +010050#endif