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> | |
564e49f3 | 11 | #include <sys/scsi.h> |
8c9ca2e6 JA |
12 | #include <sys/param.h> |
13 | #include <sys/pstat.h> | |
d48a9799 JA |
14 | #include <time.h> |
15 | #include <aio.h> | |
c00a2289 JA |
16 | |
17 | #include "../file.h" | |
18 | ||
19 | #define FIO_HAVE_POSIXAIO | |
20 | #define FIO_HAVE_ODIRECT | |
21 | #define FIO_USE_GENERIC_RAND | |
22 | #define FIO_HAVE_CLOCK_MONOTONIC | |
23 | #define FIO_HAVE_PSHARED_MUTEX | |
24 | #define FIO_HAVE_FADVISE | |
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 CLOCK_MONOTONIC |
35 | #define CLOCK_MONOTONIC CLOCK_REALTIME | |
36 | #endif | |
37 | ||
38 | #ifndef MSG_WAITALL | |
39 | #define MSG_WAITALL 0x40 | |
40 | #endif | |
41 | ||
c00a2289 JA |
42 | static inline int blockdev_invalidate_cache(struct fio_file *f) |
43 | { | |
44 | return EINVAL; | |
45 | } | |
46 | ||
47 | static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes) | |
48 | { | |
564e49f3 | 49 | struct capacity cap; |
c00a2289 | 50 | |
564e49f3 JA |
51 | if (!ioctl(f->fd, SIOC_CAPACITY, &cap) == -1) { |
52 | *bytes = cap.lba * cap.blksz; | |
c00a2289 JA |
53 | return 0; |
54 | } | |
55 | ||
564e49f3 | 56 | *bytes = 0; |
c00a2289 | 57 | return errno; |
c00a2289 JA |
58 | } |
59 | ||
60 | static inline unsigned long long os_phys_mem(void) | |
61 | { | |
8c9ca2e6 JA |
62 | unsigned long long ret; |
63 | struct pst_static pst; | |
64 | union pstun pu; | |
c00a2289 | 65 | |
8c9ca2e6 JA |
66 | pu.pst_static = &pst; |
67 | if (pstat(PSTAT_STATIC, pu, sizeof(pst), 0, 0) == -1) | |
c00a2289 JA |
68 | return 0; |
69 | ||
8c9ca2e6 JA |
70 | ret = pst.physical_memory; |
71 | ret *= pst.page_size; | |
72 | return ret; | |
c00a2289 JA |
73 | } |
74 | ||
75 | #define FIO_HAVE_CPU_ONLINE_SYSCONF | |
76 | ||
77 | static inline unsigned int cpus_online(void) | |
78 | { | |
79 | return mpctl(MPC_GETNUMSPUS, 0, NULL); | |
80 | } | |
81 | ||
82 | #endif |