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