summaryrefslogtreecommitdiff
path: root/os/os-aix.h
blob: 91c8bcda84d572f76b04fe5f12589430ca4252cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef FIO_OS_AIX_H
#define FIO_OS_AIX_H

#include <errno.h>
#include <unistd.h>
#include <sys/devinfo.h>
#include <sys/ioctl.h>

#include "../file.h"

#define FIO_HAVE_POSIXAIO
#define FIO_HAVE_ODIRECT
#define FIO_USE_GENERIC_RAND
#define FIO_HAVE_CLOCK_MONOTONIC

/*
 * This is broken on AIX if _LARGE_FILES is defined...
 */
#if 0
#define FIO_HAVE_FALLOCATE
#endif

#define FIO_HAVE_PSHARED_MUTEX

#define OS_MAP_ANON		MAP_ANON
#define OS_MSG_DONTWAIT		0

static inline int blockdev_invalidate_cache(struct fio_file *f)
{
	return EINVAL;
}

static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
{
	struct devinfo info;

	if (!ioctl(f->fd, IOCINFO, &info)) {
        	*bytes = (unsigned long long)info.un.scdk.numblks *
				info.un.scdk.blksize;
		return 0;
	}

	return errno;
}

static inline unsigned long long os_phys_mem(void)
{
	long mem = sysconf(_SC_AIX_REALMEM);

	if (mem == -1)
		return 0;

	return (unsigned long long) mem * 1024;
}

#endif