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