Commit | Line | Data |
---|---|---|
c00a2289 JA |
1 | #ifndef FIO_OS_HPUX_H |
2 | #define FIO_OS_HPUX_H | |
3 | ||
cca84643 JA |
4 | #define FIO_OS os_hpux |
5 | ||
c00a2289 JA |
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> | |
0ec15d6c | 13 | #include <sys/diskio.h> |
8c9ca2e6 JA |
14 | #include <sys/param.h> |
15 | #include <sys/pstat.h> | |
d48a9799 JA |
16 | #include <time.h> |
17 | #include <aio.h> | |
6e675fcb | 18 | #include <arm.h> |
c00a2289 JA |
19 | |
20 | #include "../file.h" | |
21 | ||
c00a2289 JA |
22 | #define FIO_HAVE_ODIRECT |
23 | #define FIO_USE_GENERIC_RAND | |
93bcfd20 | 24 | #define FIO_USE_GENERIC_INIT_RANDOM_STATE |
c00a2289 | 25 | #define FIO_HAVE_PSHARED_MUTEX |
0ec15d6c | 26 | #define FIO_HAVE_CHARDEV_SIZE |
c00a2289 JA |
27 | |
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 | ||
d48a9799 JA |
36 | #ifndef MSG_WAITALL |
37 | #define MSG_WAITALL 0x40 | |
38 | #endif | |
39 | ||
6e675fcb JA |
40 | #ifdef LITTLE_ENDIAN |
41 | #define FIO_LITTLE_ENDIAN | |
42 | #else | |
43 | #define FIO_BIG_ENDIAN | |
44 | #endif | |
45 | ||
901ebe18 JA |
46 | #define FIO_USE_GENERIC_SWAP |
47 | ||
e97c1442 JA |
48 | #define FIO_OS_HAVE_AIOCB_TYPEDEF |
49 | typedef struct aiocb64 os_aiocb_t; | |
50 | ||
c00a2289 JA |
51 | static inline int blockdev_invalidate_cache(struct fio_file *f) |
52 | { | |
53 | return EINVAL; | |
54 | } | |
55 | ||
56 | static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes) | |
57 | { | |
0ec15d6c | 58 | disk_describe_type_ext_t dext; |
c00a2289 | 59 | |
0ec15d6c JA |
60 | if (!ioctl(f->fd, DIOC_DESCRIBE_EXT, &dext)) { |
61 | unsigned long long lba; | |
62 | ||
63 | lba = ((uint64_t) dext.maxsva_high << 32) | dext.maxsva_low; | |
64 | *bytes = lba * dext.lgblksz; | |
c00a2289 JA |
65 | return 0; |
66 | } | |
67 | ||
564e49f3 | 68 | *bytes = 0; |
c00a2289 | 69 | return errno; |
c00a2289 JA |
70 | } |
71 | ||
0ec15d6c JA |
72 | static inline int chardev_size(struct fio_file *f, unsigned long long *bytes) |
73 | { | |
74 | return blockdev_size(f, bytes); | |
75 | } | |
76 | ||
c00a2289 JA |
77 | static inline unsigned long long os_phys_mem(void) |
78 | { | |
8c9ca2e6 JA |
79 | unsigned long long ret; |
80 | struct pst_static pst; | |
81 | union pstun pu; | |
c00a2289 | 82 | |
8c9ca2e6 JA |
83 | pu.pst_static = &pst; |
84 | if (pstat(PSTAT_STATIC, pu, sizeof(pst), 0, 0) == -1) | |
c00a2289 JA |
85 | return 0; |
86 | ||
8c9ca2e6 JA |
87 | ret = pst.physical_memory; |
88 | ret *= pst.page_size; | |
89 | return ret; | |
c00a2289 JA |
90 | } |
91 | ||
92 | #define FIO_HAVE_CPU_ONLINE_SYSCONF | |
93 | ||
94 | static inline unsigned int cpus_online(void) | |
95 | { | |
96 | return mpctl(MPC_GETNUMSPUS, 0, NULL); | |
97 | } | |
98 | ||
99 | #endif |