Merge pull request #487 from mayerwin/patch-1
[mono.git] / mcs / class / System.Core / System.IO.MemoryMappedFiles / MemoryMappedFile.cs
index fc0a418526a5247572409f75e21c74947395b8b5..c4f9a6624d67e6c90033b83d82a748c2d78fa9f0 100644 (file)
@@ -199,7 +199,7 @@ namespace System.IO.MemoryMappedFiles
                }
 
 
-               [DllImport("kernel32.dll", SetLastError = true)]
+               [DllImport("kernel32", SetLastError = true)]
                static extern bool SetHandleInformation (IntPtr hObject, int dwMask, int dwFlags);
                static void ConfigureWindowsFD (IntPtr handle, HandleInheritability h)
                {
@@ -482,10 +482,16 @@ namespace System.IO.MemoryMappedFiles
                        };
                }
 
+#if MOBILE
+               public static MemoryMappedFile CreateFromFile (FileStream fileStream, string mapName, long capacity, MemoryMappedFileAccess access,
+                                                              HandleInheritability inheritability,
+                                                              bool leaveOpen)
+#else
                [MonoLimitation ("memoryMappedFileSecurity is currently ignored")]
                public static MemoryMappedFile CreateFromFile (FileStream fileStream, string mapName, long capacity, MemoryMappedFileAccess access,
                                                               MemoryMappedFileSecurity memoryMappedFileSecurity, HandleInheritability inheritability,
                                                               bool leaveOpen)
+#endif
                {
                        if (fileStream == null)
                                throw new ArgumentNullException ("fileStream");
@@ -508,19 +514,33 @@ namespace System.IO.MemoryMappedFiles
                [MonoLimitation ("CreateNew requires that mapName be a file name on Unix")]
                public static MemoryMappedFile CreateNew (string mapName, long capacity)
                {
+#if MOBILE
+                       return CreateNew (mapName, capacity, MemoryMappedFileAccess.ReadWrite, MemoryMappedFileOptions.DelayAllocatePages, 0);
+#else
                        return CreateNew (mapName, capacity, MemoryMappedFileAccess.ReadWrite, MemoryMappedFileOptions.DelayAllocatePages, null, 0);
+#endif
                }
 
                [MonoLimitation ("CreateNew requires that mapName be a file name on Unix")]
                public static MemoryMappedFile CreateNew (string mapName, long capacity, MemoryMappedFileAccess access) 
                {
+#if MOBILE
+                       return CreateNew (mapName, capacity, access, MemoryMappedFileOptions.DelayAllocatePages, 0);
+#else
                        return CreateNew (mapName, capacity, access, MemoryMappedFileOptions.DelayAllocatePages, null, 0);
+#endif
                }
 
+#if MOBILE
+               public static MemoryMappedFile CreateNew (string mapName, long capacity, MemoryMappedFileAccess access,
+                                                         MemoryMappedFileOptions options, 
+                                                         HandleInheritability handleInheritability)
+#else
                [MonoLimitation ("CreateNew requires that mapName be a file name on Unix; options and memoryMappedFileSecurity are ignored")]
                public static MemoryMappedFile CreateNew (string mapName, long capacity, MemoryMappedFileAccess access,
                                                          MemoryMappedFileOptions options, MemoryMappedFileSecurity memoryMappedFileSecurity,
                                                          HandleInheritability inheritability)
+#endif
                {
                        return CreateFromFile (mapName, FileMode.CreateNew, mapName, capacity, access);
                }
@@ -538,7 +558,11 @@ namespace System.IO.MemoryMappedFiles
                }
 
                [MonoTODO]
+#if MOBILE
+               public static MemoryMappedFile CreateOrOpen (string mapName, long capacity, MemoryMappedFileAccess access, MemoryMappedFileOptions options, HandleInheritability inheritability)
+#else
                public static MemoryMappedFile CreateOrOpen (string mapName, long capacity, MemoryMappedFileAccess access, MemoryMappedFileOptions options, MemoryMappedFileSecurity memoryMappedFileSecurity, HandleInheritability inheritability)
+#endif
                {
                        throw new NotImplementedException ();
                }
@@ -618,6 +642,7 @@ namespace System.IO.MemoryMappedFiles
                        }
                }
 
+#if !MOBILE
                [MonoTODO]
                public MemoryMappedFileSecurity GetAccessControl ()
                {
@@ -629,6 +654,7 @@ namespace System.IO.MemoryMappedFiles
                {
                        throw new NotImplementedException ();
                }
+#endif
 
                [MonoTODO]
                public SafeMemoryMappedFileHandle SafeMemoryMappedFileHandle {