Declare __page_shift and __page_size with C linkage.
__page_shift and __page_size were accidentally declared in unistd.h with
C linkage - their implementation needs to use the same linkage.
Going forward, though, let's stop the inlining madness and let's kill
the non-standard __getpageshift(). This patch takes getpagesize(3) out
of line and removes __getpageshift but fixes __page_shift and __page_size
for backwards binary compatibility.
Change-Id: I35ed66a08989ced1db422eb03e4d154a5d6b5bda
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
diff --git a/libc/bionic/stubs.cpp b/libc/bionic/stubs.cpp
index e8411b7..56f5c045 100644
--- a/libc/bionic/stubs.cpp
+++ b/libc/bionic/stubs.cpp
@@ -469,3 +469,15 @@
void endusershell() {
UNIMPLEMENTED;
}
+
+// Portable code should use sysconf(_SC_PAGESIZE) directly instead.
+int getpagesize() {
+ return sysconf(_SC_PAGESIZE);
+}
+
+// These were accidentally declared in <unistd.h> because we stupidly used to inline
+// getpagesize() and __getpageshift(). Needed for backwards compatibility with old NDK apps.
+extern "C" {
+ unsigned int __page_size = PAGE_SIZE;
+ unsigned int __page_shift = PAGE_SHIFT;
+}