blob: 1870e6e46f9c14676c53394eaadff3383a08d675 [file] [log] [blame]
Cigy Cyriacbf2e8212010-08-10 19:51:11 -04001#ifndef FIO_OS_AIX_H
2#define FIO_OS_AIX_H
3
Jens Axboecca84642011-10-07 12:47:57 +02004#define FIO_OS os_aix
5
Cigy Cyriacbf2e8212010-08-10 19:51:11 -04006#include <errno.h>
7#include <unistd.h>
8#include <sys/devinfo.h>
9#include <sys/ioctl.h>
10
Jens Axboee2e58882011-01-04 08:36:06 +010011#include "../file.h"
12
Cigy Cyriacbf2e8212010-08-10 19:51:11 -040013#define FIO_HAVE_POSIXAIO
Cigy Cyriacbf2e8212010-08-10 19:51:11 -040014#define FIO_HAVE_ODIRECT
15#define FIO_USE_GENERIC_RAND
Bruce Cran93bcfd22012-02-20 20:18:19 +010016#define FIO_USE_GENERIC_INIT_RANDOM_STATE
Bruce Cranecc314b2011-01-04 10:59:30 +010017#define FIO_HAVE_CLOCK_MONOTONIC
Cigy Cyriacbf2e8212010-08-10 19:51:11 -040018
Jens Axboe282cc162010-08-11 16:14:56 -040019/*
20 * This is broken on AIX if _LARGE_FILES is defined...
21 */
22#if 0
23#define FIO_HAVE_FALLOCATE
24#endif
25
Cigy Cyriacbf2e8212010-08-10 19:51:11 -040026#define FIO_HAVE_PSHARED_MUTEX
27
28#define OS_MAP_ANON MAP_ANON
Jens Axboe8e239ca2010-08-11 10:29:12 -040029#define OS_MSG_DONTWAIT 0
Cigy Cyriacbf2e8212010-08-10 19:51:11 -040030
Jens Axboed05c4a02011-10-05 00:16:11 +020031#if BYTE_ORDER == BIG_ENDIAN
Jens Axboea9df7072011-10-04 23:54:28 +020032#define FIO_BIG_ENDIAN
Jens Axboed05c4a02011-10-05 00:16:11 +020033#else
34#define FIO_LITTLE_ENDIAN
35#endif
36
Jens Axboea9df7072011-10-04 23:54:28 +020037#define FIO_USE_GENERIC_SWAP
38
Jens Axboed05c4a02011-10-05 00:16:11 +020039#define FIO_OS_HAVE_SOCKLEN_T
40#define fio_socklen_t socklen_t
41
Bruce Cran9b836562011-01-08 19:49:54 +010042static inline int blockdev_invalidate_cache(struct fio_file *f)
Cigy Cyriacbf2e8212010-08-10 19:51:11 -040043{
44 return EINVAL;
45}
46
Bruce Cranecc314b2011-01-04 10:59:30 +010047static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
Cigy Cyriacbf2e8212010-08-10 19:51:11 -040048{
49 struct devinfo info;
50
Bruce Cranecc314b2011-01-04 10:59:30 +010051 if (!ioctl(f->fd, IOCINFO, &info)) {
Cigy Cyriacbf2e8212010-08-10 19:51:11 -040052 *bytes = (unsigned long long)info.un.scdk.numblks *
53 info.un.scdk.blksize;
54 return 0;
55 }
56
57 return errno;
58}
59
60static inline unsigned long long os_phys_mem(void)
61{
62 long mem = sysconf(_SC_AIX_REALMEM);
63
64 if (mem == -1)
65 return 0;
66
67 return (unsigned long long) mem * 1024;
68}
69
70#endif