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