diff --git a/CHANGES.md b/CHANGES.md index ef944fcbbc..d3fd493457 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,6 +11,7 @@ Features Bug Fixes --------- +* [#1618](https://github.com/java-native-access/jna/issues/1618): Fix calls to jnidispatch on Android with 16KB page size - [@Thomyrock](https://github.com/Thomyrock) Release 5.15.0 ============== diff --git a/common.xml b/common.xml index 3e14365a7f..4a91e8c1a6 100644 --- a/common.xml +++ b/common.xml @@ -22,7 +22,7 @@ - + diff --git a/contrib/platform/test/com/sun/jna/platform/linux/UdevTest.java b/contrib/platform/test/com/sun/jna/platform/linux/UdevTest.java index 90dc035fb9..5724a176a3 100644 --- a/contrib/platform/test/com/sun/jna/platform/linux/UdevTest.java +++ b/contrib/platform/test/com/sun/jna/platform/linux/UdevTest.java @@ -29,6 +29,8 @@ import com.sun.jna.platform.linux.Udev.UdevDevice; import com.sun.jna.platform.linux.Udev.UdevEnumerate; import com.sun.jna.platform.linux.Udev.UdevListEntry; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import junit.framework.TestCase; @@ -37,6 +39,8 @@ */ public class UdevTest extends TestCase { + private static final Pattern SCSI_DISK_PATTERN = Pattern.compile(".*/sd[a-z](\\d+)$"); + @Test public void testEnumerateDevices() { // Start with the context object @@ -74,7 +78,10 @@ public void testEnumerateDevices() { // No additional reference is acquired from getParent if (parent != null && parent2 != null) { // Devnode should match same parent without restricting to block and disk - assertEquals("Partition parent should match with and without filter", + assertEquals(String.format( + "Partition parent should match with and without filter (%s)", + devnode + ), parent.getDevnode(), parent2.getDevnode()); // Save the size and major parentSize = parent.getSysattrValue("size"); @@ -82,21 +89,29 @@ public void testEnumerateDevices() { } } String size = device.getSysattrValue("size"); - assertTrue("Size must be nonnegative", 0 <= Long.parseLong(size)); + assertTrue(String.format("Size must be nonnegative (%s)", devnode), 0 <= Long.parseLong(size)); if (parentSize != null) { - assertTrue("Partition can't be bigger than its disk", + assertTrue(String.format("Partition can't be bigger than its disk (%s)", devnode), Long.parseLong(size) <= Long.parseLong(parentSize)); } String major = device.getPropertyValue("MAJOR"); - assertTrue("Major value must be nonnegative", 0 <= Long.parseLong(major)); + assertTrue(String.format("Major value must be nonnegative (%s)", devnode), 0 <= Long.parseLong(major)); if (parentMajor != null) { - assertEquals("Partition and its parent disk should have same major number", major, - parentMajor); + // For scsi disks only the first 15 Partitions have the + // same major as their disk + Matcher scsiMatcher = SCSI_DISK_PATTERN.matcher(devnode); + boolean scsiDiskDynamicMinor = scsiMatcher.matches() && Integer.parseInt(scsiMatcher.group(1)) > 15; + if(! scsiDiskDynamicMinor) { + assertEquals( + String.format("Partition and its parent disk should have same major number (%s)", devnode), + major, parentMajor + ); + } } - assertEquals("DevType mismatch", devType, device.getDevtype()); - assertEquals("Subsystem mismatch", "block", device.getSubsystem()); - assertEquals("Syspath mismatch", syspath, device.getSyspath()); - assertTrue("Syspath should end with name", syspath.endsWith(device.getSysname())); + assertEquals(String.format("DevType mismatch (%s)", devnode), devType, device.getDevtype()); + assertEquals(String.format("Subsystem mismatch (%s)", devnode), "block", device.getSubsystem()); + assertEquals(String.format("Syspath mismatch (%s)", devnode), syspath, device.getSyspath()); + assertTrue(String.format("Syspath should end with name (%s)", devnode), syspath.endsWith(device.getSysname())); } } finally { // Release the reference and iterate to the next device diff --git a/lib/native/android-aarch64.jar b/lib/native/android-aarch64.jar index cd80cf8b54..27f5b527f3 100644 Binary files a/lib/native/android-aarch64.jar and b/lib/native/android-aarch64.jar differ diff --git a/lib/native/android-arm.jar b/lib/native/android-arm.jar index 64871d5df3..a5d0bc9528 100644 Binary files a/lib/native/android-arm.jar and b/lib/native/android-arm.jar differ diff --git a/lib/native/android-armv7.jar b/lib/native/android-armv7.jar index 8fbd871cea..84a7698dda 100644 Binary files a/lib/native/android-armv7.jar and b/lib/native/android-armv7.jar differ diff --git a/lib/native/android-mips.jar b/lib/native/android-mips.jar index 6db1796eb8..16e0487175 100644 Binary files a/lib/native/android-mips.jar and b/lib/native/android-mips.jar differ diff --git a/lib/native/android-mips64.jar b/lib/native/android-mips64.jar index fcb48e3faa..23b1cafc63 100644 Binary files a/lib/native/android-mips64.jar and b/lib/native/android-mips64.jar differ diff --git a/lib/native/android-x86-64.jar b/lib/native/android-x86-64.jar index 4f8a42dd0d..df2eb368f8 100644 Binary files a/lib/native/android-x86-64.jar and b/lib/native/android-x86-64.jar differ diff --git a/lib/native/android-x86.jar b/lib/native/android-x86.jar index ced6b8deb4..a81ea2ef2f 100644 Binary files a/lib/native/android-x86.jar and b/lib/native/android-x86.jar differ diff --git a/native/Makefile b/native/Makefile index 49240421e9..79a7b0e3d7 100644 --- a/native/Makefile +++ b/native/Makefile @@ -176,12 +176,12 @@ CPP=$(PREFIX)cpp LD=$(CC) RANLIB=$(PREFIX)ranlib STRIP=$(PREFIX)strip -x -CDEFINES=-DFFI_STATIC_BUILD -DNO_JAWT -DNO_WEAK_GLOBALS -DFFI_MMAP_EXEC_WRIT=1 -DFFI_MMAP_EXEC_SELINUX=0 +CDEFINES=-DFFI_STATIC_BUILD -DNO_JAWT -DNO_WEAK_GLOBALS -DFFI_MMAP_EXEC_WRIT=1 -DFFI_MMAP_EXEC_SELINUX=0 -Dmalloc_getpagesize='getpagesize()' COPT+=-fpic -ffunction-sections -funwind-tables -fno-short-enums JAVA_INCLUDES= CINCLUDES+=-I"$(NDK_PLATFORM)/arch-$(AARCH)/usr/include" # -I/usr/include LIBS=-nostdlib -L"$(NDK_PLATFORM)/arch-$(AARCH)$(ALIBDIR)/" -lgcc -lc -ldl -lm -LDFLAGS+=-Wl,-shared,-Bsymbolic -Wl,--build-id=sha1 +LDFLAGS+=-Wl,-shared,-Bsymbolic -Wl,--build-id=sha1 -Wl,-z,max-page-size=16384 FFI_ENV=CPP="$(CPP)" CC="$(CC)" CFLAGS="$(COPT) $(CDEBUG) $(CINCLUDES)" CPPFLAGS="$(CDEFINES) $(CINCLUDES)" LIBS="$(LIBS)" RANLIB="$(RANLIB)" FFI_CONFIG=--enable-static --disable-shared --with-pic=yes --host=$(HOST) endif