ACLs now work on Windows. Tests all the way up to DirectorySecurityTest and FileSecur...
[mono.git] / mcs / class / System.Core / System.IO.MemoryMappedFiles / MemoryMappedViewAccessor.cs
index 02453c8666553a584f4c04d954bad31b79012048..288930202882696e6387803d56de3e56f4630c77 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 
 using System;
 using System.IO;
 using System.Collections.Generic;
 using Microsoft.Win32.SafeHandles;
-using Mono.Unix.Native;
 
 namespace System.IO.MemoryMappedFiles
 {
@@ -44,10 +43,7 @@ namespace System.IO.MemoryMappedFiles
                internal MemoryMappedViewAccessor (int file_handle, long offset, long size, MemoryMappedFileAccess access)
                {
                        this.file_handle = file_handle;
-                       if (MonoUtil.IsUnix)
-                               CreatePosix (offset, size, access);
-                       else
-                               throw new NotImplementedException ("Not implemented on windows.");
+                       Create (offset, size, access);
                }
 
                static FileAccess ToFileAccess (MemoryMappedFileAccess access)
@@ -68,11 +64,11 @@ namespace System.IO.MemoryMappedFiles
                        }
                }
                
-               unsafe void CreatePosix (long offset, long size, MemoryMappedFileAccess access)
+               unsafe void Create (long offset, long size, MemoryMappedFileAccess access)
                {
                        int offset_diff;
 
-                       MemoryMappedFile.MapPosix (file_handle, offset, ref size, access, out mmap_addr, out offset_diff);
+                       MemoryMapImpl.Map (file_handle, offset, ref size, access, out mmap_addr, out offset_diff);
 
                        handle = new SafeMemoryMappedViewHandle ((IntPtr)((long)mmap_addr + offset_diff), size);
                        Initialize (handle, 0, size, ToFileAccess (access));
@@ -95,10 +91,7 @@ namespace System.IO.MemoryMappedFiles
 
                public void Flush ()
                {
-                       if (MonoUtil.IsUnix)
-                               Syscall.fsync (file_handle);
-                       else
-                               throw new NotImplementedException ("Not implemented on Windows");
+                       MemoryMapImpl.Flush (file_handle);
                }
        }
 }