Commit | Line | Data |
---|---|---|
ebac4655 JA |
1 | #ifndef FIO_OS_FREEBSD_H |
2 | #define FIO_OS_FREEBSD_H | |
3 | ||
5c4e1dbc JA |
4 | #include <sys/sysctl.h> |
5 | ||
ebac4655 JA |
6 | #undef FIO_HAVE_LIBAIO |
7 | #define FIO_HAVE_POSIXAIO | |
8 | #undef FIO_HAVE_FADVISE | |
9 | #undef FIO_HAVE_CPU_AFFINITY | |
10 | #undef FIO_HAVE_DISK_UTIL | |
11 | #undef FIO_HAVE_SGIO | |
2c0ecd28 | 12 | #define FIO_HAVE_ODIRECT |
ebac4655 JA |
13 | |
14 | #define OS_MAP_ANON (MAP_ANON) | |
15 | ||
16 | typedef unsigned long os_cpu_mask_t; | |
6dfd46b9 | 17 | typedef unsigned int os_random_state_t; |
ebac4655 JA |
18 | |
19 | /* | |
20 | * FIXME | |
21 | */ | |
9104f874 | 22 | static inline int blockdev_size(int fd, unsigned long long *bytes) |
ebac4655 | 23 | { |
e5b401d4 JA |
24 | return EINVAL; |
25 | } | |
26 | ||
27 | static inline int blockdev_invalidate_cache(int fd) | |
28 | { | |
29 | return EINVAL; | |
ebac4655 JA |
30 | } |
31 | ||
32cd46a0 JA |
32 | static inline unsigned long long os_phys_mem(void) |
33 | { | |
34 | int mib[2] = { CTL_HW, HW_PHYSMEM }; | |
35 | unsigned long long mem; | |
36 | size_t len = sizeof(mem); | |
37 | ||
38 | sysctl(mib, 2, &mem, &len, NULL, 0); | |
39 | return mem; | |
40 | } | |
41 | ||
6dfd46b9 JA |
42 | static inline void os_random_seed(unsigned long seed, os_random_state_t *rs) |
43 | { | |
44 | srand(seed); | |
45 | } | |
46 | ||
47 | static inline long os_random_long(os_random_state_t *rs) | |
48 | { | |
49 | long val; | |
50 | ||
51 | val = rand_r(rs); | |
52 | return val; | |
53 | } | |
54 | ||
ebac4655 | 55 | #endif |