Fix getpriority/setpriority types.
Bug: N/A
Test: builds
Change-Id: Ica099bae04a0260871783452811a54672094ba4a
diff --git a/libc/Android.bp b/libc/Android.bp
index 04c62b3..cea3305 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -4,7 +4,6 @@
"bionic/ether_aton.c",
"bionic/ether_ntoa.c",
"bionic/fts.c",
- "bionic/getpriority.c",
"bionic/initgroups.c",
"bionic/isatty.c",
"bionic/pututline.c",
@@ -1256,6 +1255,7 @@
"bionic/getpagesize.cpp",
"bionic/getpgrp.cpp",
"bionic/getpid.cpp",
+ "bionic/getpriority.cpp",
"bionic/gettid.cpp",
"bionic/__gnu_basename.cpp",
"bionic/grp_pwd.cpp",
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index 42c8f01..781d404 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -62,8 +62,8 @@
# <sys/resource.h>
int getrusage(int, struct rusage*) all
-int __getpriority:getpriority(int, int) all
-int setpriority(int, int, int) all
+int __getpriority:getpriority(int, id_t) all
+int setpriority(int, id_t, int) all
# On LP64, rlimit and rlimit64 are the same.
# On 32-bit systems we use prlimit64 to implement the rlimit64 functions.
int getrlimit:ugetrlimit(int, struct rlimit*) arm,x86
diff --git a/libc/bionic/getpriority.c b/libc/bionic/getpriority.cpp
similarity index 91%
rename from libc/bionic/getpriority.c
rename to libc/bionic/getpriority.cpp
index efc9d4e..7f0eb1c 100644
--- a/libc/bionic/getpriority.c
+++ b/libc/bionic/getpriority.cpp
@@ -25,13 +25,12 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
+
#include <sys/resource.h>
-extern int __getpriority(int, int);
+extern "C" int __getpriority(int, id_t);
-int getpriority(int which, int who)
-{
+int getpriority(int which, id_t who) {
int result = __getpriority(which, who);
-
- return ( result < 0 ) ? result : 20-result;
+ return (result < 0) ? result : 20-result;
}
diff --git a/libc/include/sys/resource.h b/libc/include/sys/resource.h
index 248310e..7c43ca3 100644
--- a/libc/include/sys/resource.h
+++ b/libc/include/sys/resource.h
@@ -48,8 +48,8 @@
int getrlimit64(int, struct rlimit64*) __INTRODUCED_IN(21);
int setrlimit64(int, const struct rlimit64*) __INTRODUCED_IN(21);
-int getpriority(int, int);
-int setpriority(int, int, int);
+int getpriority(int, id_t);
+int setpriority(int, id_t, int);
int getrusage(int, struct rusage*);