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> | |
8393ca93 | 9 | #include <fcntl.h> |
c00a2289 JA |
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 | 22 | #define FIO_HAVE_ODIRECT |
93bcfd20 | 23 | #define FIO_USE_GENERIC_INIT_RANDOM_STATE |
0ec15d6c | 24 | #define FIO_HAVE_CHARDEV_SIZE |
c00a2289 JA |
25 | |
26 | #define OS_MAP_ANON MAP_ANONYMOUS | |
27 | #define OS_MSG_DONTWAIT 0 | |
28 | ||
29 | #define POSIX_MADV_DONTNEED MADV_DONTNEED | |
30 | #define POSIX_MADV_SEQUENTIAL MADV_SEQUENTIAL | |
31 | #define POSIX_MADV_RANDOM MADV_RANDOM | |
32 | #define posix_madvise(ptr, sz, hint) madvise((ptr), (sz), (hint)) | |
33 | ||
d48a9799 JA |
34 | #ifndef MSG_WAITALL |
35 | #define MSG_WAITALL 0x40 | |
36 | #endif | |
37 | ||
901ebe18 JA |
38 | #define FIO_USE_GENERIC_SWAP |
39 | ||
e97c1442 JA |
40 | #define FIO_OS_HAVE_AIOCB_TYPEDEF |
41 | typedef struct aiocb64 os_aiocb_t; | |
42 | ||
c00a2289 JA |
43 | static inline int blockdev_invalidate_cache(struct fio_file *f) |
44 | { | |
22de5d77 | 45 | return ENOTSUP; |
c00a2289 JA |
46 | } |
47 | ||
48 | static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes) | |
49 | { | |
0ec15d6c | 50 | disk_describe_type_ext_t dext; |
c00a2289 | 51 | |
0ec15d6c JA |
52 | if (!ioctl(f->fd, DIOC_DESCRIBE_EXT, &dext)) { |
53 | unsigned long long lba; | |
54 | ||
55 | lba = ((uint64_t) dext.maxsva_high << 32) | dext.maxsva_low; | |
56 | *bytes = lba * dext.lgblksz; | |
c00a2289 JA |
57 | return 0; |
58 | } | |
59 | ||
564e49f3 | 60 | *bytes = 0; |
c00a2289 | 61 | return errno; |
c00a2289 JA |
62 | } |
63 | ||
0ec15d6c JA |
64 | static inline int chardev_size(struct fio_file *f, unsigned long long *bytes) |
65 | { | |
66 | return blockdev_size(f, bytes); | |
67 | } | |
68 | ||
c00a2289 JA |
69 | static inline unsigned long long os_phys_mem(void) |
70 | { | |
8c9ca2e6 JA |
71 | unsigned long long ret; |
72 | struct pst_static pst; | |
73 | union pstun pu; | |
c00a2289 | 74 | |
8c9ca2e6 JA |
75 | pu.pst_static = &pst; |
76 | if (pstat(PSTAT_STATIC, pu, sizeof(pst), 0, 0) == -1) | |
c00a2289 JA |
77 | return 0; |
78 | ||
8c9ca2e6 JA |
79 | ret = pst.physical_memory; |
80 | ret *= pst.page_size; | |
81 | return ret; | |
c00a2289 JA |
82 | } |
83 | ||
84 | #define FIO_HAVE_CPU_ONLINE_SYSCONF | |
85 | ||
86 | static inline unsigned int cpus_online(void) | |
87 | { | |
88 | return mpctl(MPC_GETNUMSPUS, 0, NULL); | |
89 | } | |
90 | ||
91 | #endif |