blob: 82acd1105fc51aa22f3976643a18999b245ebb3e [file] [log] [blame]
Jens Axboec00a2282011-07-08 20:56:06 +02001#ifndef FIO_OS_HPUX_H
2#define FIO_OS_HPUX_H
3
Jens Axboecca84642011-10-07 12:47:57 +02004#define FIO_OS os_hpux
5
Jens Axboec00a2282011-07-08 20:56:06 +02006#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 Axboe0ec15d62011-07-11 10:48:51 +020013#include <sys/diskio.h>
Jens Axboe8c9ca2e2011-07-11 10:25:35 +020014#include <sys/param.h>
15#include <sys/pstat.h>
Jens Axboed48a9792011-07-09 08:54:26 +020016#include <time.h>
17#include <aio.h>
Jens Axboe6e675fc2011-10-04 13:56:06 +020018#include <arm.h>
Jens Axboec00a2282011-07-08 20:56:06 +020019
20#include "../file.h"
21
Jens Axboec00a2282011-07-08 20:56:06 +020022#define FIO_HAVE_ODIRECT
23#define FIO_USE_GENERIC_RAND
Bruce Cran93bcfd22012-02-20 20:18:19 +010024#define FIO_USE_GENERIC_INIT_RANDOM_STATE
Jens Axboec00a2282011-07-08 20:56:06 +020025#define FIO_HAVE_PSHARED_MUTEX
Jens Axboe0ec15d62011-07-11 10:48:51 +020026#define FIO_HAVE_CHARDEV_SIZE
Jens Axboec00a2282011-07-08 20:56:06 +020027
28#define OS_MAP_ANON MAP_ANONYMOUS
29#define OS_MSG_DONTWAIT 0
30
31#define POSIX_MADV_DONTNEED MADV_DONTNEED
32#define POSIX_MADV_SEQUENTIAL MADV_SEQUENTIAL
33#define POSIX_MADV_RANDOM MADV_RANDOM
34#define posix_madvise(ptr, sz, hint) madvise((ptr), (sz), (hint))
35
Jens Axboed48a9792011-07-09 08:54:26 +020036#ifndef MSG_WAITALL
37#define MSG_WAITALL 0x40
38#endif
39
Jens Axboe901ebe12011-10-04 23:31:00 +020040#define FIO_USE_GENERIC_SWAP
41
Jens Axboee97c1442011-09-21 09:38:01 +020042#define FIO_OS_HAVE_AIOCB_TYPEDEF
43typedef struct aiocb64 os_aiocb_t;
44
Jens Axboec00a2282011-07-08 20:56:06 +020045static inline int blockdev_invalidate_cache(struct fio_file *f)
46{
47 return EINVAL;
48}
49
50static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
51{
Jens Axboe0ec15d62011-07-11 10:48:51 +020052 disk_describe_type_ext_t dext;
Jens Axboec00a2282011-07-08 20:56:06 +020053
Jens Axboe0ec15d62011-07-11 10:48:51 +020054 if (!ioctl(f->fd, DIOC_DESCRIBE_EXT, &dext)) {
55 unsigned long long lba;
56
57 lba = ((uint64_t) dext.maxsva_high << 32) | dext.maxsva_low;
58 *bytes = lba * dext.lgblksz;
Jens Axboec00a2282011-07-08 20:56:06 +020059 return 0;
60 }
61
Jens Axboe564e49f2011-07-08 21:10:30 +020062 *bytes = 0;
Jens Axboec00a2282011-07-08 20:56:06 +020063 return errno;
Jens Axboec00a2282011-07-08 20:56:06 +020064}
65
Jens Axboe0ec15d62011-07-11 10:48:51 +020066static inline int chardev_size(struct fio_file *f, unsigned long long *bytes)
67{
68 return blockdev_size(f, bytes);
69}
70
Jens Axboec00a2282011-07-08 20:56:06 +020071static inline unsigned long long os_phys_mem(void)
72{
Jens Axboe8c9ca2e2011-07-11 10:25:35 +020073 unsigned long long ret;
74 struct pst_static pst;
75 union pstun pu;
Jens Axboec00a2282011-07-08 20:56:06 +020076
Jens Axboe8c9ca2e2011-07-11 10:25:35 +020077 pu.pst_static = &pst;
78 if (pstat(PSTAT_STATIC, pu, sizeof(pst), 0, 0) == -1)
Jens Axboec00a2282011-07-08 20:56:06 +020079 return 0;
80
Jens Axboe8c9ca2e2011-07-11 10:25:35 +020081 ret = pst.physical_memory;
82 ret *= pst.page_size;
83 return ret;
Jens Axboec00a2282011-07-08 20:56:06 +020084}
85
86#define FIO_HAVE_CPU_ONLINE_SYSCONF
87
88static inline unsigned int cpus_online(void)
89{
90 return mpctl(MPC_GETNUMSPUS, 0, NULL);
91}
92
93#endif