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