Move file service type defines to file.h
[fio.git] / os / os-freebsd.h
CommitLineData
ebac4655
JA
1#ifndef FIO_OS_FREEBSD_H
2#define FIO_OS_FREEBSD_H
3
690dec6e 4#include <errno.h>
5c4e1dbc
JA
5#include <sys/sysctl.h>
6
ebac4655 7#define FIO_HAVE_POSIXAIO
2c0ecd28 8#define FIO_HAVE_ODIRECT
ebac4655 9
dc873b6f 10#define OS_MAP_ANON MAP_ANON
ebac4655
JA
11
12typedef unsigned long os_cpu_mask_t;
6dfd46b9 13typedef unsigned int os_random_state_t;
ebac4655
JA
14
15/*
16 * FIXME
17 */
9104f874 18static inline int blockdev_size(int fd, unsigned long long *bytes)
ebac4655 19{
e5b401d4
JA
20 return EINVAL;
21}
22
23static inline int blockdev_invalidate_cache(int fd)
24{
25 return EINVAL;
ebac4655
JA
26}
27
32cd46a0
JA
28static 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
6dfd46b9
JA
38static 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
ebac4655 51#endif