blob: 91c8bcda84d572f76b04fe5f12589430ca4252cd [file] [log] [blame]
Cigy Cyriacbf2e8212010-08-10 19:51:11 -04001#ifndef FIO_OS_AIX_H
2#define FIO_OS_AIX_H
3
4#include <errno.h>
5#include <unistd.h>
6#include <sys/devinfo.h>
7#include <sys/ioctl.h>
8
Jens Axboee2e58882011-01-04 08:36:06 +01009#include "../file.h"
10
Cigy Cyriacbf2e8212010-08-10 19:51:11 -040011#define FIO_HAVE_POSIXAIO
Cigy Cyriacbf2e8212010-08-10 19:51:11 -040012#define FIO_HAVE_ODIRECT
13#define FIO_USE_GENERIC_RAND
Bruce Cranecc314b2011-01-04 10:59:30 +010014#define FIO_HAVE_CLOCK_MONOTONIC
Cigy Cyriacbf2e8212010-08-10 19:51:11 -040015
Jens Axboe282cc162010-08-11 16:14:56 -040016/*
17 * This is broken on AIX if _LARGE_FILES is defined...
18 */
19#if 0
20#define FIO_HAVE_FALLOCATE
21#endif
22
Cigy Cyriacbf2e8212010-08-10 19:51:11 -040023#define FIO_HAVE_PSHARED_MUTEX
24
25#define OS_MAP_ANON MAP_ANON
Jens Axboe8e239ca2010-08-11 10:29:12 -040026#define OS_MSG_DONTWAIT 0
Cigy Cyriacbf2e8212010-08-10 19:51:11 -040027
Bruce Cran9b836562011-01-08 19:49:54 +010028static inline int blockdev_invalidate_cache(struct fio_file *f)
Cigy Cyriacbf2e8212010-08-10 19:51:11 -040029{
30 return EINVAL;
31}
32
Bruce Cranecc314b2011-01-04 10:59:30 +010033static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
Cigy Cyriacbf2e8212010-08-10 19:51:11 -040034{
35 struct devinfo info;
36
Bruce Cranecc314b2011-01-04 10:59:30 +010037 if (!ioctl(f->fd, IOCINFO, &info)) {
Cigy Cyriacbf2e8212010-08-10 19:51:11 -040038 *bytes = (unsigned long long)info.un.scdk.numblks *
39 info.un.scdk.blksize;
40 return 0;
41 }
42
43 return errno;
44}
45
46static inline unsigned long long os_phys_mem(void)
47{
48 long mem = sysconf(_SC_AIX_REALMEM);
49
50 if (mem == -1)
51 return 0;
52
53 return (unsigned long long) mem * 1024;
54}
55
56#endif