Commit | Line | Data |
---|---|---|
ebac4655 JA |
1 | #ifndef FIO_OS_FREEBSD_H |
2 | #define FIO_OS_FREEBSD_H | |
3 | ||
690dec6e | 4 | #include <errno.h> |
5c4e1dbc | 5 | #include <sys/sysctl.h> |
aa5e69b2 | 6 | #include <sys/disk.h> |
5c4e1dbc | 7 | |
ebac4655 | 8 | #define FIO_HAVE_POSIXAIO |
2c0ecd28 | 9 | #define FIO_HAVE_ODIRECT |
53531370 | 10 | #define FIO_USE_GENERIC_RAND |
ebac4655 | 11 | |
dc873b6f | 12 | #define OS_MAP_ANON MAP_ANON |
ebac4655 | 13 | |
907249cf JA |
14 | typedef off_t off64_t; |
15 | ||
aa5e69b2 JA |
16 | static inline int blockdev_size(int fd, unsigned long long *bytes) |
17 | { | |
18 | off_t size; | |
19 | ||
20 | if (!ioctl(fd, DIOCGMEDIASIZE, &size)) { | |
21 | *bytes = size; | |
22 | return 0; | |
23 | } | |
24 | ||
2fa55e93 | 25 | *bytes = 0; |
aa5e69b2 JA |
26 | return errno; |
27 | } | |
28 | ||
e5b401d4 JA |
29 | static inline int blockdev_invalidate_cache(int fd) |
30 | { | |
31 | return EINVAL; | |
ebac4655 JA |
32 | } |
33 | ||
32cd46a0 JA |
34 | static inline unsigned long long os_phys_mem(void) |
35 | { | |
36 | int mib[2] = { CTL_HW, HW_PHYSMEM }; | |
37 | unsigned long long mem; | |
38 | size_t len = sizeof(mem); | |
39 | ||
40 | sysctl(mib, 2, &mem, &len, NULL, 0); | |
41 | return mem; | |
42 | } | |
43 | ||
a1c58075 JA |
44 | #ifdef MADV_FREE |
45 | #define FIO_MADV_FREE MADV_FREE | |
46 | #endif | |
47 | ||
ebac4655 | 48 | #endif |