Replace usage of PAGE_SIZE Per RFC 0016[1], page size in userspace should be a runtime determination and this constant should go away. [1] https://fuchsia.dev/fuchsia-src/contribute/governance/rfcs/0016_boot_time_page_sizes Bug: 42146863 Change-Id: I09aabf29a24d3124b3d914fa86242d3c941297d6 Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/android.googlesource.com/platform/system/libfmq/+/1421424 Reviewed-by: James Robinson <jamesr@google.com>
diff --git a/tests/fmq_unit_tests.cpp b/tests/fmq_unit_tests.cpp index c6b72ce..7b1ae5a 100644 --- a/tests/fmq_unit_tests.cpp +++ b/tests/fmq_unit_tests.cpp
@@ -29,6 +29,8 @@ #include <thread> #if defined(__Fuchsia__) +#include <zircon/syscalls.h> + #include "vendor/google/starnix/android/remote_binder/lutex.h" #endif @@ -164,9 +166,10 @@ public: #if defined(__Fuchsia__) RegisteredFutex() { + const size_t page_size = zx_system_get_page_size(); android::base::unique_fd fd(::ashmem_create_region( - "RegisteredFutex", PAGE_SIZE)); - mapping = mmap(0, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd.get(), 0); + "RegisteredFutex", page_size)); + mapping = mmap(0, page_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd.get(), 0); if (mapping != MAP_FAILED) { starnix::register_lutex(fd.get(), 0, mapping); } @@ -174,7 +177,7 @@ ~RegisteredFutex() { starnix::unregister_lutex(mapping); - munmap(mapping, PAGE_SIZE); + munmap(mapping, zx_system_get_page_size()); } #else RegisteredFutex() {