Jens Axboe | c50bdd8 | 2010-05-21 07:14:04 +0200 | [diff] [blame] | 1 | #ifndef FIO_OS_NETBSD_H |
| 2 | #define FIO_OS_NETBSD_H |
| 3 | |
| 4 | #include <errno.h> |
| 5 | #include <sys/param.h> |
Jens Axboe | b939683 | 2011-07-30 13:29:58 +0200 | [diff] [blame] | 6 | #include <sys/thr.h> |
Jens Axboe | 901ebe1 | 2011-10-04 23:31:00 +0200 | [diff] [blame^] | 7 | #include <sys/endian.h> |
Jens Axboe | c50bdd8 | 2010-05-21 07:14:04 +0200 | [diff] [blame] | 8 | /* XXX hack to avoid confilcts between rbtree.h and <sys/rb.h> */ |
| 9 | #define rb_node _rb_node |
| 10 | #include <sys/sysctl.h> |
| 11 | #undef rb_node |
| 12 | #undef rb_left |
| 13 | #undef rb_right |
| 14 | |
Jens Axboe | e2e5888 | 2011-01-04 08:36:06 +0100 | [diff] [blame] | 15 | #include "../file.h" |
| 16 | |
Jens Axboe | c50bdd8 | 2010-05-21 07:14:04 +0200 | [diff] [blame] | 17 | #define FIO_HAVE_POSIXAIO |
| 18 | #define FIO_HAVE_FADVISE |
Jens Axboe | c50bdd8 | 2010-05-21 07:14:04 +0200 | [diff] [blame] | 19 | #define FIO_HAVE_ODIRECT |
| 20 | #define FIO_HAVE_STRSEP |
| 21 | #define FIO_HAVE_FDATASYNC |
| 22 | #define FIO_USE_GENERIC_BDEV_SIZE |
| 23 | #define FIO_USE_GENERIC_RAND |
Jens Axboe | b9afd95 | 2011-07-12 23:49:16 +0200 | [diff] [blame] | 24 | #define FIO_HAVE_GETTID |
Jens Axboe | c50bdd8 | 2010-05-21 07:14:04 +0200 | [diff] [blame] | 25 | |
| 26 | #undef FIO_HAVE_CPU_AFFINITY /* XXX notyet */ |
| 27 | |
| 28 | #define OS_MAP_ANON MAP_ANON |
| 29 | |
Bruce Cran | 9b83656 | 2011-01-08 19:49:54 +0100 | [diff] [blame] | 30 | #ifndef PTHREAD_STACK_MIN |
| 31 | #define PTHREAD_STACK_MIN 4096 |
| 32 | #endif |
| 33 | |
Jens Axboe | 901ebe1 | 2011-10-04 23:31:00 +0200 | [diff] [blame^] | 34 | #if BYTE_ORDER == LITTLE_ENDIAN |
| 35 | #define FIO_LITTLE_ENDIAN |
| 36 | #else |
| 37 | #define FIO_BIG_ENDIAN |
| 38 | #endif |
| 39 | |
| 40 | #define fio_swap16(x) bswap16(x) |
| 41 | #define fio_swap32(x) bswap32(x) |
| 42 | #define fio_swap64(x) bswap64(x) |
| 43 | |
Jens Axboe | c50bdd8 | 2010-05-21 07:14:04 +0200 | [diff] [blame] | 44 | typedef off_t off64_t; |
| 45 | |
Bruce Cran | 9b83656 | 2011-01-08 19:49:54 +0100 | [diff] [blame] | 46 | static inline int blockdev_invalidate_cache(struct fio_file *f) |
Jens Axboe | c50bdd8 | 2010-05-21 07:14:04 +0200 | [diff] [blame] | 47 | { |
| 48 | return EINVAL; |
| 49 | } |
| 50 | |
| 51 | static inline unsigned long long os_phys_mem(void) |
| 52 | { |
| 53 | int mib[2] = { CTL_HW, HW_PHYSMEM64 }; |
| 54 | uint64_t mem; |
| 55 | size_t len = sizeof(mem); |
| 56 | |
| 57 | sysctl(mib, 2, &mem, &len, NULL, 0); |
| 58 | return mem; |
| 59 | } |
| 60 | |
Jens Axboe | b9afd95 | 2011-07-12 23:49:16 +0200 | [diff] [blame] | 61 | static inline int gettid(void) |
| 62 | { |
| 63 | long lwpid; |
| 64 | |
| 65 | thr_self(&lwpid); |
| 66 | return (int) lwpid; |
| 67 | } |
| 68 | |
Jens Axboe | c50bdd8 | 2010-05-21 07:14:04 +0200 | [diff] [blame] | 69 | #ifdef MADV_FREE |
| 70 | #define FIO_MADV_FREE MADV_FREE |
| 71 | #endif |
| 72 | |
| 73 | /* XXX NetBSD doesn't have getopt_long_only */ |
| 74 | #define getopt_long_only getopt_long |
| 75 | |
| 76 | #endif |