diff options
author | Dan Albert <danalbert@google.com> | 2014-06-13 02:56:31 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-06-13 02:56:31 +0000 |
commit | 9b2d964d0139198c2cce2b8f6bb5b1a566e47913 (patch) | |
tree | 800f5ffe0475dc05d0a8b152fd5effa1b7b17902 | |
parent | 3bff77a8f90e673dbf41d97b7b842a3e4a6986bf (diff) | |
parent | 08430b1e8c9cf42289289d88e7dd05294da7589e (diff) | |
download | system_core-9b2d964d0139198c2cce2b8f6bb5b1a566e47913.zip system_core-9b2d964d0139198c2cce2b8f6bb5b1a566e47913.tar.gz system_core-9b2d964d0139198c2cce2b8f6bb5b1a566e47913.tar.bz2 |
am 08430b1e: Merge "Use syscall(2) instead of ioprio_get/ioprio_set."
* commit '08430b1e8c9cf42289289d88e7dd05294da7589e':
Use syscall(2) instead of ioprio_get/ioprio_set.
-rw-r--r-- | libcutils/iosched_policy.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/libcutils/iosched_policy.c b/libcutils/iosched_policy.c index 67e101d..3e80cb2 100644 --- a/libcutils/iosched_policy.c +++ b/libcutils/iosched_policy.c @@ -19,33 +19,21 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <sys/syscall.h> #include <unistd.h> -#ifdef HAVE_SCHED_H - #include <cutils/iosched_policy.h> #ifdef HAVE_ANDROID_OS -/* #include <linux/ioprio.h> */ -extern int ioprio_set(int which, int who, int ioprio); -extern int ioprio_get(int which, int who); +#include <linux/ioprio.h> #define __android_unused #else #define __android_unused __attribute__((__unused__)) #endif -enum { - WHO_PROCESS = 1, - WHO_PGRP, - WHO_USER, -}; - -#define CLASS_SHIFT 13 -#define IOPRIO_NORM 4 - int android_set_ioprio(int pid __android_unused, IoSchedClass clazz __android_unused, int ioprio __android_unused) { #ifdef HAVE_ANDROID_OS - if (ioprio_set(WHO_PROCESS, pid, ioprio | (clazz << CLASS_SHIFT))) { + if (syscall(SYS_ioprio_set, IOPRIO_WHO_PROCESS, pid, ioprio | (clazz << IOPRIO_CLASS_SHIFT))) { return -1; } #endif @@ -56,11 +44,11 @@ int android_get_ioprio(int pid __android_unused, IoSchedClass *clazz, int *iopri #ifdef HAVE_ANDROID_OS int rc; - if ((rc = ioprio_get(WHO_PROCESS, pid)) < 0) { + if ((rc = syscall(SYS_ioprio_get, IOPRIO_WHO_PROCESS, pid)) < 0) { return -1; } - *clazz = (rc >> CLASS_SHIFT); + *clazz = (rc >> IOPRIO_CLASS_SHIFT); *ioprio = (rc & 0xff); #else *clazz = IoSchedClass_NONE; @@ -68,5 +56,3 @@ int android_get_ioprio(int pid __android_unused, IoSchedClass *clazz, int *iopri #endif return 0; } - -#endif /* HAVE_SCHED_H */ |