Partially fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=12739
Android's libc.so doesn't export getpagesize(3), resulting in an
EntryPointNotFoundException:
System.EntryPointNotFoundException: getpagesize
at (wrapper managed-to-native) System.IO.MemoryMappedFiles.MemoryMapImpl.getpagesize ()
at System.IO.MemoryMappedFiles.MemoryMapImpl.Map (int,long,long&,System.IO.MemoryMappedFiles.MemoryMappedFileAccess,intptr&,int&)
at System.IO.MemoryMappedFiles.MemoryMappedViewAccessor.Create (long,long,System.IO.MemoryMappedFiles.MemoryMappedFileAccess)
at System.IO.MemoryMappedFiles.MemoryMappedViewAccessor..ctor (int,long,long,System.IO.MemoryMappedFiles.MemoryMappedFileAccess)
at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateViewAccessor (long,long,System.IO.MemoryMappedFiles.MemoryMappedFileAccess)
Android does provide getpagesize(3); it's just an inline function.
The full fix will require two parts:
1. Update MemoryMapImpl to P/Invoke
libmonodroid.so!monodroid_getpagesize()
2. Add a libmonodroid.so!monodroid_getpagesize() export.
This commit implements (1).
[DllImport ("libc", SetLastError=true)]
static extern int open (string path, int flags, int access);
+#if MONODROID
+ [DllImport ("__Internal")]
+ static extern int monodroid_getpagesize ();
+
+ static int getpagesize ()
+ {
+ return monodroid_getpagesize ();
+ }
+#else
[DllImport ("libc")]
static extern int getpagesize ();
+#endif
[MethodImplAttribute (MethodImplOptions.InternalCall)]
static extern long mono_filesize_from_path (string str);