// 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
{
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)
}
}
- 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));
public void Flush ()
{
- if (MonoUtil.IsUnix)
- Syscall.fsync (file_handle);
- else
- throw new NotImplementedException ("Not implemented on Windows");
+ MemoryMapImpl.Flush (file_handle);
}
}
}