android: add shm syscalls and fix ioprio definitions
authorAaron Carroll <xaaronc@gmail.com>
Fri, 12 Apr 2013 05:59:01 +0000 (07:59 +0200)
committerJens Axboe <axboe@kernel.dk>
Fri, 12 Apr 2013 05:59:01 +0000 (07:59 +0200)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
arch/arch-x86.h
os/os-android.h

index 8eea5381f41a75443a4cd200286b4690d62ffd79..69cf60b3de5f772c566d88a3cb0dfa9ba0b55d5e 100644 (file)
 #define __NR_sys_vmsplice      316
 #endif
 
+#ifndef __NR_shmget
+#define __NR_shmget 29
+#define __NR_shmat 30
+#define __NR_shmctl 31
+#endif
+
 #define        FIO_HUGE_PAGE           4194304
 
 #define nop            __asm__ __volatile__("rep;nop": : :"memory")
index 070aa1a3eee3cf7392664940d22bc99c2cc8735e..b8449828ae63534971cf11ed731948c5d5078d60 100644 (file)
@@ -79,11 +79,6 @@ 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,
@@ -100,6 +95,18 @@ enum {
 #define IOPRIO_BITS            16
 #define IOPRIO_CLASS_SHIFT     13
 
+static inline int ioprio_set(int which, int who, int ioprio_class, int ioprio)
+{
+       /*
+        * If no class is set, assume BE
+        */
+       if (!ioprio_class)
+               ioprio_class = IOPRIO_CLASS_BE;
+
+       ioprio |= ioprio_class << IOPRIO_CLASS_SHIFT;
+       return syscall(__NR_ioprio_set, which, who, ioprio);
+}
+
 #ifndef BLKGETSIZE64
 #define BLKGETSIZE64   _IOR(0x12,114,size_t)
 #endif