Jens Axboe | c00a228 | 2011-07-08 20:56:06 +0200 | [diff] [blame] | 1 | #ifndef FIO_OS_HPUX_H |
| 2 | #define FIO_OS_HPUX_H |
| 3 | |
| 4 | #include <errno.h> |
| 5 | #include <unistd.h> |
| 6 | #include <sys/ioctl.h> |
| 7 | #include <sys/fcntl.h> |
| 8 | #include <sys/fadvise.h> |
| 9 | #include <sys/mman.h> |
| 10 | #include <sys/mpctl.h> |
Jens Axboe | 0ec15d6 | 2011-07-11 10:48:51 +0200 | [diff] [blame] | 11 | #include <sys/diskio.h> |
Jens Axboe | 8c9ca2e | 2011-07-11 10:25:35 +0200 | [diff] [blame] | 12 | #include <sys/param.h> |
| 13 | #include <sys/pstat.h> |
Jens Axboe | d48a979 | 2011-07-09 08:54:26 +0200 | [diff] [blame] | 14 | #include <time.h> |
| 15 | #include <aio.h> |
Jens Axboe | 6e675fc | 2011-10-04 13:56:06 +0200 | [diff] [blame] | 16 | #include <arm.h> |
Jens Axboe | c00a228 | 2011-07-08 20:56:06 +0200 | [diff] [blame] | 17 | |
| 18 | #include "../file.h" |
| 19 | |
| 20 | #define FIO_HAVE_POSIXAIO |
| 21 | #define FIO_HAVE_ODIRECT |
| 22 | #define FIO_USE_GENERIC_RAND |
| 23 | #define FIO_HAVE_CLOCK_MONOTONIC |
| 24 | #define FIO_HAVE_PSHARED_MUTEX |
| 25 | #define FIO_HAVE_FADVISE |
Jens Axboe | 0ec15d6 | 2011-07-11 10:48:51 +0200 | [diff] [blame] | 26 | #define FIO_HAVE_CHARDEV_SIZE |
Jens Axboe | baa6677 | 2011-07-11 10:56:32 +0200 | [diff] [blame] | 27 | #define FIO_HAVE_FALLOCATE |
| 28 | #define FIO_HAVE_POSIXAIO_FSYNC |
Jens Axboe | 893b37c | 2011-07-11 14:43:26 +0200 | [diff] [blame] | 29 | #define FIO_HAVE_FDATASYNC |
Jens Axboe | c00a228 | 2011-07-08 20:56:06 +0200 | [diff] [blame] | 30 | |
| 31 | #define OS_MAP_ANON MAP_ANONYMOUS |
| 32 | #define OS_MSG_DONTWAIT 0 |
| 33 | |
| 34 | #define POSIX_MADV_DONTNEED MADV_DONTNEED |
| 35 | #define POSIX_MADV_SEQUENTIAL MADV_SEQUENTIAL |
| 36 | #define POSIX_MADV_RANDOM MADV_RANDOM |
| 37 | #define posix_madvise(ptr, sz, hint) madvise((ptr), (sz), (hint)) |
| 38 | |
Jens Axboe | d48a979 | 2011-07-09 08:54:26 +0200 | [diff] [blame] | 39 | #ifndef CLOCK_MONOTONIC |
| 40 | #define CLOCK_MONOTONIC CLOCK_REALTIME |
| 41 | #endif |
| 42 | |
| 43 | #ifndef MSG_WAITALL |
| 44 | #define MSG_WAITALL 0x40 |
| 45 | #endif |
| 46 | |
Jens Axboe | 6e675fc | 2011-10-04 13:56:06 +0200 | [diff] [blame] | 47 | #ifdef LITTLE_ENDIAN |
| 48 | #define FIO_LITTLE_ENDIAN |
| 49 | #else |
| 50 | #define FIO_BIG_ENDIAN |
| 51 | #endif |
| 52 | |
Jens Axboe | 901ebe1 | 2011-10-04 23:31:00 +0200 | [diff] [blame^] | 53 | #define FIO_USE_GENERIC_SWAP |
| 54 | |
Jens Axboe | e97c144 | 2011-09-21 09:38:01 +0200 | [diff] [blame] | 55 | #define FIO_OS_HAVE_AIOCB_TYPEDEF |
| 56 | typedef struct aiocb64 os_aiocb_t; |
| 57 | |
Jens Axboe | c00a228 | 2011-07-08 20:56:06 +0200 | [diff] [blame] | 58 | static inline int blockdev_invalidate_cache(struct fio_file *f) |
| 59 | { |
| 60 | return EINVAL; |
| 61 | } |
| 62 | |
| 63 | static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes) |
| 64 | { |
Jens Axboe | 0ec15d6 | 2011-07-11 10:48:51 +0200 | [diff] [blame] | 65 | disk_describe_type_ext_t dext; |
Jens Axboe | c00a228 | 2011-07-08 20:56:06 +0200 | [diff] [blame] | 66 | |
Jens Axboe | 0ec15d6 | 2011-07-11 10:48:51 +0200 | [diff] [blame] | 67 | if (!ioctl(f->fd, DIOC_DESCRIBE_EXT, &dext)) { |
| 68 | unsigned long long lba; |
| 69 | |
| 70 | lba = ((uint64_t) dext.maxsva_high << 32) | dext.maxsva_low; |
| 71 | *bytes = lba * dext.lgblksz; |
Jens Axboe | c00a228 | 2011-07-08 20:56:06 +0200 | [diff] [blame] | 72 | return 0; |
| 73 | } |
| 74 | |
Jens Axboe | 564e49f | 2011-07-08 21:10:30 +0200 | [diff] [blame] | 75 | *bytes = 0; |
Jens Axboe | c00a228 | 2011-07-08 20:56:06 +0200 | [diff] [blame] | 76 | return errno; |
Jens Axboe | c00a228 | 2011-07-08 20:56:06 +0200 | [diff] [blame] | 77 | } |
| 78 | |
Jens Axboe | 0ec15d6 | 2011-07-11 10:48:51 +0200 | [diff] [blame] | 79 | static inline int chardev_size(struct fio_file *f, unsigned long long *bytes) |
| 80 | { |
| 81 | return blockdev_size(f, bytes); |
| 82 | } |
| 83 | |
Jens Axboe | c00a228 | 2011-07-08 20:56:06 +0200 | [diff] [blame] | 84 | static inline unsigned long long os_phys_mem(void) |
| 85 | { |
Jens Axboe | 8c9ca2e | 2011-07-11 10:25:35 +0200 | [diff] [blame] | 86 | unsigned long long ret; |
| 87 | struct pst_static pst; |
| 88 | union pstun pu; |
Jens Axboe | c00a228 | 2011-07-08 20:56:06 +0200 | [diff] [blame] | 89 | |
Jens Axboe | 8c9ca2e | 2011-07-11 10:25:35 +0200 | [diff] [blame] | 90 | pu.pst_static = &pst; |
| 91 | if (pstat(PSTAT_STATIC, pu, sizeof(pst), 0, 0) == -1) |
Jens Axboe | c00a228 | 2011-07-08 20:56:06 +0200 | [diff] [blame] | 92 | return 0; |
| 93 | |
Jens Axboe | 8c9ca2e | 2011-07-11 10:25:35 +0200 | [diff] [blame] | 94 | ret = pst.physical_memory; |
| 95 | ret *= pst.page_size; |
| 96 | return ret; |
Jens Axboe | c00a228 | 2011-07-08 20:56:06 +0200 | [diff] [blame] | 97 | } |
| 98 | |
| 99 | #define FIO_HAVE_CPU_ONLINE_SYSCONF |
| 100 | |
| 101 | static inline unsigned int cpus_online(void) |
| 102 | { |
| 103 | return mpctl(MPC_GETNUMSPUS, 0, NULL); |
| 104 | } |
| 105 | |
| 106 | #endif |