소스 검색

[System.Core/Android] Android's libc.so doesn't export getpagesize()

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).
Jonathan Pryor 12 년 전
부모
커밋
0e7dc370e3
1개의 변경된 파일10개의 추가작업 그리고 0개의 파일을 삭제
  1. 10 0
      mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs

+ 10 - 0
mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs

@@ -236,8 +236,18 @@ namespace System.IO.MemoryMappedFiles
 		[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);