diff options
| author | 2023-08-09 15:47:20 -0700 | |
|---|---|---|
| committer | 2023-08-09 15:50:08 -0700 | |
| commit | 66f3a96a7969837beaffc92e04c7a92d1c76f2ae (patch) | |
| tree | aafe7b3361fe7b980873be15e8f5ca32a485956f /vulkan/libvulkan | |
| parent | e88ec57f5ec6dce50d0c2a6d1468145b77cde99e (diff) | |
libvulkan: Remove use of hardcoded PAGE_SIZE 4096
bionic hard codes the PAGE_SIZE macro as 4096. This is going away as
Android begins to support larger page sizes. Remove the usage of this
assumption from libvulkan source; use instead getpagesize() which
provides the real pagesize.
Test: mma
Bug: 295227858
Change-Id: Ie7c2c2f47d8c61c7495dbd3d88bb63ccf7a74063
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
Diffstat (limited to 'vulkan/libvulkan')
| -rw-r--r-- | vulkan/libvulkan/layers_extensions.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/vulkan/libvulkan/layers_extensions.cpp b/vulkan/libvulkan/layers_extensions.cpp index a14fed222a..d059f8fe4c 100644 --- a/vulkan/libvulkan/layers_extensions.cpp +++ b/vulkan/libvulkan/layers_extensions.cpp @@ -23,6 +23,7 @@ #include <dlfcn.h> #include <string.h> #include <sys/prctl.h> +#include <unistd.h> #include <mutex> #include <string> @@ -362,6 +363,7 @@ template <typename Functor> void ForEachFileInZip(const std::string& zipname, const std::string& dir_in_zip, Functor functor) { + static const size_t kPageSize = getpagesize(); int32_t err; ZipArchiveHandle zip = nullptr; if ((err = OpenArchive(zipname.c_str(), &zip)) != 0) { @@ -389,7 +391,7 @@ void ForEachFileInZip(const std::string& zipname, // the APK. Loading still may fail for other reasons, but this at least // lets us avoid failed-to-load log messages in the typical case of // compressed and/or unaligned libraries. - if (entry.method != kCompressStored || entry.offset % PAGE_SIZE != 0) + if (entry.method != kCompressStored || entry.offset % kPageSize != 0) continue; functor(filename); } |