Android: add ioprio support
[fio.git] / os / os-android.h
index cedfdaf8ea8ca0910715580a08ee317d8fc3dd12..070aa1a3eee3cf7392664940d22bc99c2cc8735e 100644 (file)
@@ -19,6 +19,7 @@
 
 #define FIO_HAVE_DISK_UTIL
 #define FIO_HAVE_IOSCHED_SWITCH
+#define FIO_HAVE_IOPRIO
 #define FIO_HAVE_ODIRECT
 #define FIO_HAVE_HUGETLB
 #define FIO_HAVE_BLKTRACE
@@ -31,6 +32,7 @@
 #define FIO_HAVE_E4_ENG
 #define FIO_HAVE_BYTEORDER_FUNCS
 #define FIO_HAVE_MMAP_HUGE
+#define FIO_NO_HAVE_SHM_H
 
 #define OS_MAP_ANON            MAP_ANONYMOUS
 
@@ -41,6 +43,9 @@
 #ifdef MADV_REMOVE
 #define FIO_MADV_FREE  MADV_REMOVE
 #endif
+#ifndef MAP_HUGETLB
+#define MAP_HUGETLB 0x40000 /* arch specific */
+#endif
 
 
 /*
@@ -74,6 +79,27 @@ static inline int shmdt (const void *__shmaddr)
 
 #define SPLICE_DEF_SIZE        (64*1024)
 
+static inline int ioprio_set(int which, int who, int ioprio)
+{
+       return syscall(__NR_ioprio_set, which, who, ioprio);
+}
+
+enum {
+       IOPRIO_CLASS_NONE,
+       IOPRIO_CLASS_RT,
+       IOPRIO_CLASS_BE,
+       IOPRIO_CLASS_IDLE,
+};
+
+enum {
+       IOPRIO_WHO_PROCESS = 1,
+       IOPRIO_WHO_PGRP,
+       IOPRIO_WHO_USER,
+};
+
+#define IOPRIO_BITS            16
+#define IOPRIO_CLASS_SHIFT     13
+
 #ifndef BLKGETSIZE64
 #define BLKGETSIZE64   _IOR(0x12,114,size_t)
 #endif