NativeLibraryHelper: 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 NativeLibraryHelper source; use instead getpagesize() which provides the real pagesize. Test: mma Bug: 295082607 Change-Id: If59fdc17379adda1dcd6e78e754e7e17ef49423d Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
This commit is contained in:
@@ -174,6 +174,7 @@ sumFiles(JNIEnv*, void* arg, ZipFileRO* zipFile, ZipEntryRO zipEntry, const char
|
||||
static install_status_t
|
||||
copyFileIfChanged(JNIEnv *env, void* arg, ZipFileRO* zipFile, ZipEntryRO zipEntry, const char* fileName)
|
||||
{
|
||||
static const size_t kPageSize = getpagesize();
|
||||
void** args = reinterpret_cast<void**>(arg);
|
||||
jstring* javaNativeLibPath = (jstring*) args[0];
|
||||
jboolean extractNativeLibs = *(jboolean*) args[1];
|
||||
@@ -200,9 +201,9 @@ copyFileIfChanged(JNIEnv *env, void* arg, ZipFileRO* zipFile, ZipEntryRO zipEntr
|
||||
return INSTALL_FAILED_INVALID_APK;
|
||||
}
|
||||
|
||||
if (offset % PAGE_SIZE != 0) {
|
||||
ALOGE("Library '%s' is not page-aligned - will not be able to open it directly from"
|
||||
" apk.\n", fileName);
|
||||
if (offset % kPageSize != 0) {
|
||||
ALOGE("Library '%s' is not PAGE(%zu)-aligned - will not be able to open it directly "
|
||||
"from apk.\n", fileName, kPageSize);
|
||||
return INSTALL_FAILED_INVALID_APK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user