aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Moreland <smoreland@google.com>2024-04-08 19:04:38 +0000
committerSteven Moreland <smoreland@google.com>2024-04-09 16:35:15 +0000
commita69e5af7ee56875508a750be0ac1eaba92b4a2c0 (patch)
tree33a1cdd5f73c61e676d940b1c1b4abb052367dd0
parentb97459693eefb6c8e39e560cd1febef6177afd82 (diff)
downloadbionic-a69e5af7ee56875508a750be0ac1eaba92b4a2c0.tar.gz
Prefer __BIONIC_DEPRECATED_PAGE_SIZE_MACRO
Platform and future NDK releases will have no PAGE_SIZE by default, unless __BIONIC_DEPRECATED_PAGE_SIZE_MACRO is specified. This ensures that when people use these headers with non-standard build systems, they will still become aware of the changes. Bug: 312546062 Test: build/boot Change-Id: I29f5de2cd5d59d3cefdd45a6da1ccdd7c12f1f19
-rw-r--r--libc/include/bits/page_size.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/libc/include/bits/page_size.h b/libc/include/bits/page_size.h
index df0cb7fcc..594ffe5e8 100644
--- a/libc/include/bits/page_size.h
+++ b/libc/include/bits/page_size.h
@@ -32,7 +32,16 @@
__BEGIN_DECLS
-#if !defined(__BIONIC_NO_PAGE_SIZE_MACRO) || defined(__BIONIC_DEPRECATED_PAGE_SIZE_MACRO)
+// PAGE_SIZE is going away in Android. Prefer getpagesize() instead.
+//
+// For more info, see https://developer.android.com/16kb-page-size.
+//
+// To restore the original behavior, use __BIONIC_DEPRECATED_PAGE_SIZE_MACRO.
+
+#if (defined(__NDK_MAJOR__) && __NDK_MAJOR__ <= 27 && !defined(__BIONIC_NO_PAGE_SIZE_MACRO)) \
+ || defined(__BIONIC_DEPRECATED_PAGE_SIZE_MACRO) \
+ || defined(__arm__) \
+ || defined(__i386__)
#define PAGE_SIZE 4096
#define PAGE_MASK (~(PAGE_SIZE - 1))
#endif