cts: fix build for 64-bit
64-bit doesn't have an mmap2 syscall, call mmap directly.
Use PRIxPTR to print a uintptr_t.
Change-Id: Ib1b28d5d2938c2617fd4c5c5d68848f87cf6a183
diff --git a/tests/tests/security/jni/android_security_cts_NativeCodeTest.cpp b/tests/tests/security/jni/android_security_cts_NativeCodeTest.cpp
index e8ff57a..2f3fb79 100644
--- a/tests/tests/security/jni/android_security_cts_NativeCodeTest.cpp
+++ b/tests/tests/security/jni/android_security_cts_NativeCodeTest.cpp
@@ -33,6 +33,7 @@
#include <cutils/log.h>
#include <linux/perf_event.h>
#include <errno.h>
+#include <inttypes.h>
#define PASSED 0
#define UNKNOWN_ERROR -1
@@ -201,7 +202,7 @@
// We found an address which isn't in our our, or our child's,
// address space, but yet which is still writable. Scribble
// all over it.
- ALOGE("parent: found writable at %x", addr);
+ ALOGE("parent: found writable at %" PRIxPTR, addr);
uintptr_t addr2;
for (addr2 = addr; addr2 < addr + SEARCH_SIZE; addr2++) {
syscall(__NR_ptrace, PTRACE_PEEKDATA, child, &secret, addr2);
@@ -243,7 +244,11 @@
static void* mmap_syscall(void* addr, size_t len, int prot, int flags, int fd, off_t offset)
{
+#ifdef __LP64__
+ return mmap(addr, len, prot, flags, fd, offset);
+#else
return (void*) syscall(__NR_mmap2, addr, len, prot, flags, fd, offset);
+#endif
}
#define KBASE_REG_COOKIE_TB 2