38a1441db292627379ab2f301daea5979e92e27c
[fio.git] / os / os-hpux.h
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>
11 #include <sys/scsi.h>
12 #include <time.h>
13 #include <aio.h>
14
15 #include "../file.h"
16
17 #define FIO_HAVE_POSIXAIO
18 #define FIO_HAVE_ODIRECT
19 #define FIO_USE_GENERIC_RAND
20 #define FIO_HAVE_CLOCK_MONOTONIC
21 #define FIO_HAVE_PSHARED_MUTEX
22 #define FIO_HAVE_FADVISE
23
24 #define OS_MAP_ANON             MAP_ANONYMOUS
25 #define OS_MSG_DONTWAIT         0
26
27 #define POSIX_MADV_DONTNEED     MADV_DONTNEED
28 #define POSIX_MADV_SEQUENTIAL   MADV_SEQUENTIAL
29 #define POSIX_MADV_RANDOM       MADV_RANDOM
30 #define posix_madvise(ptr, sz, hint)    madvise((ptr), (sz), (hint))
31
32 #ifndef CLOCK_MONOTONIC
33 #define CLOCK_MONOTONIC         CLOCK_REALTIME
34 #endif
35
36 #ifndef MSG_WAITALL
37 #define MSG_WAITALL     0x40
38 #endif
39
40 static inline int blockdev_invalidate_cache(struct fio_file *f)
41 {
42         return EINVAL;
43 }
44
45 static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
46 {
47         struct capacity cap;
48
49         if (!ioctl(f->fd, SIOC_CAPACITY, &cap) == -1) {
50                 *bytes = cap.lba * cap.blksz;
51                 return 0;
52         }
53
54         *bytes = 0;
55         return errno;
56 }
57
58 static inline unsigned long long os_phys_mem(void)
59 {
60 #if 0
61         long mem = sysconf(_SC_AIX_REALMEM);
62
63         if (mem == -1)
64                 return 0;
65
66         return (unsigned long long) mem * 1024;
67 #else
68         return 0;
69 #endif
70 }
71
72 #define FIO_HAVE_CPU_ONLINE_SYSCONF
73
74 static inline unsigned int cpus_online(void)
75 {
76         return mpctl(MPC_GETNUMSPUS, 0, NULL);
77 }
78
79 #endif