Cigy Cyriac | bf2e821 | 2010-08-10 19:51:11 -0400 | [diff] [blame] | 1 | #ifndef FIO_OS_AIX_H |
| 2 | #define FIO_OS_AIX_H |
| 3 | |
Jens Axboe | cca8464 | 2011-10-07 12:47:57 +0200 | [diff] [blame] | 4 | #define FIO_OS os_aix |
| 5 | |
Cigy Cyriac | bf2e821 | 2010-08-10 19:51:11 -0400 | [diff] [blame] | 6 | #include <errno.h> |
| 7 | #include <unistd.h> |
| 8 | #include <sys/devinfo.h> |
| 9 | #include <sys/ioctl.h> |
| 10 | |
Jens Axboe | e2e5888 | 2011-01-04 08:36:06 +0100 | [diff] [blame] | 11 | #include "../file.h" |
| 12 | |
Cigy Cyriac | bf2e821 | 2010-08-10 19:51:11 -0400 | [diff] [blame] | 13 | #define FIO_HAVE_POSIXAIO |
Cigy Cyriac | bf2e821 | 2010-08-10 19:51:11 -0400 | [diff] [blame] | 14 | #define FIO_HAVE_ODIRECT |
| 15 | #define FIO_USE_GENERIC_RAND |
Bruce Cran | 93bcfd2 | 2012-02-20 20:18:19 +0100 | [diff] [blame] | 16 | #define FIO_USE_GENERIC_INIT_RANDOM_STATE |
Bruce Cran | ecc314b | 2011-01-04 10:59:30 +0100 | [diff] [blame] | 17 | #define FIO_HAVE_CLOCK_MONOTONIC |
Cigy Cyriac | bf2e821 | 2010-08-10 19:51:11 -0400 | [diff] [blame] | 18 | |
Jens Axboe | 282cc16 | 2010-08-11 16:14:56 -0400 | [diff] [blame] | 19 | /* |
| 20 | * This is broken on AIX if _LARGE_FILES is defined... |
| 21 | */ |
| 22 | #if 0 |
| 23 | #define FIO_HAVE_FALLOCATE |
| 24 | #endif |
| 25 | |
Cigy Cyriac | bf2e821 | 2010-08-10 19:51:11 -0400 | [diff] [blame] | 26 | #define FIO_HAVE_PSHARED_MUTEX |
| 27 | |
| 28 | #define OS_MAP_ANON MAP_ANON |
Jens Axboe | 8e239ca | 2010-08-11 10:29:12 -0400 | [diff] [blame] | 29 | #define OS_MSG_DONTWAIT 0 |
Cigy Cyriac | bf2e821 | 2010-08-10 19:51:11 -0400 | [diff] [blame] | 30 | |
Jens Axboe | d05c4a0 | 2011-10-05 00:16:11 +0200 | [diff] [blame] | 31 | #if BYTE_ORDER == BIG_ENDIAN |
Jens Axboe | a9df707 | 2011-10-04 23:54:28 +0200 | [diff] [blame] | 32 | #define FIO_BIG_ENDIAN |
Jens Axboe | d05c4a0 | 2011-10-05 00:16:11 +0200 | [diff] [blame] | 33 | #else |
| 34 | #define FIO_LITTLE_ENDIAN |
| 35 | #endif |
| 36 | |
Jens Axboe | a9df707 | 2011-10-04 23:54:28 +0200 | [diff] [blame] | 37 | #define FIO_USE_GENERIC_SWAP |
| 38 | |
Jens Axboe | d05c4a0 | 2011-10-05 00:16:11 +0200 | [diff] [blame] | 39 | #define FIO_OS_HAVE_SOCKLEN_T |
| 40 | #define fio_socklen_t socklen_t |
| 41 | |
Bruce Cran | 9b83656 | 2011-01-08 19:49:54 +0100 | [diff] [blame] | 42 | static inline int blockdev_invalidate_cache(struct fio_file *f) |
Cigy Cyriac | bf2e821 | 2010-08-10 19:51:11 -0400 | [diff] [blame] | 43 | { |
| 44 | return EINVAL; |
| 45 | } |
| 46 | |
Bruce Cran | ecc314b | 2011-01-04 10:59:30 +0100 | [diff] [blame] | 47 | static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes) |
Cigy Cyriac | bf2e821 | 2010-08-10 19:51:11 -0400 | [diff] [blame] | 48 | { |
| 49 | struct devinfo info; |
| 50 | |
Bruce Cran | ecc314b | 2011-01-04 10:59:30 +0100 | [diff] [blame] | 51 | if (!ioctl(f->fd, IOCINFO, &info)) { |
Cigy Cyriac | bf2e821 | 2010-08-10 19:51:11 -0400 | [diff] [blame] | 52 | *bytes = (unsigned long long)info.un.scdk.numblks * |
| 53 | info.un.scdk.blksize; |
| 54 | return 0; |
| 55 | } |
| 56 | |
| 57 | return errno; |
| 58 | } |
| 59 | |
| 60 | static inline unsigned long long os_phys_mem(void) |
| 61 | { |
| 62 | long mem = sysconf(_SC_AIX_REALMEM); |
| 63 | |
| 64 | if (mem == -1) |
| 65 | return 0; |
| 66 | |
| 67 | return (unsigned long long) mem * 1024; |
| 68 | } |
| 69 | |
| 70 | #endif |