Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 1 | #ifndef FIO_OS_FREEBSD_H |
| 2 | #define FIO_OS_FREEBSD_H |
| 3 | |
Jens Axboe | 5c4e1db | 2006-06-07 14:17:08 +0200 | [diff] [blame] | 4 | #include <sys/sysctl.h> |
| 5 | |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 6 | #define FIO_HAVE_POSIXAIO |
Jens Axboe | 2c0ecd2 | 2006-06-08 13:25:41 +0200 | [diff] [blame] | 7 | #define FIO_HAVE_ODIRECT |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 8 | |
Jens Axboe | dc873b6 | 2008-06-04 20:13:04 +0200 | [diff] [blame^] | 9 | #define OS_MAP_ANON MAP_ANON |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 10 | |
| 11 | typedef unsigned long os_cpu_mask_t; |
Jens Axboe | 6dfd46b | 2006-06-07 13:57:06 +0200 | [diff] [blame] | 12 | typedef unsigned int os_random_state_t; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 13 | |
| 14 | /* |
| 15 | * FIXME |
| 16 | */ |
Jens Axboe | 9104f87 | 2005-12-28 23:50:45 +0100 | [diff] [blame] | 17 | static inline int blockdev_size(int fd, unsigned long long *bytes) |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 18 | { |
Jens Axboe | e5b401d | 2006-10-18 16:03:40 +0200 | [diff] [blame] | 19 | return EINVAL; |
| 20 | } |
| 21 | |
| 22 | static inline int blockdev_invalidate_cache(int fd) |
| 23 | { |
| 24 | return EINVAL; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 25 | } |
| 26 | |
Jens Axboe | 32cd46a | 2006-06-07 13:40:40 +0200 | [diff] [blame] | 27 | static 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 Axboe | 6dfd46b | 2006-06-07 13:57:06 +0200 | [diff] [blame] | 37 | static inline void os_random_seed(unsigned long seed, os_random_state_t *rs) |
| 38 | { |
| 39 | srand(seed); |
| 40 | } |
| 41 | |
| 42 | static 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 Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 50 | #endif |