Hey, The attached patch makes the custom MemoryMapping work on Mono.
-- Jb EvainĀ <j...@nurv.fr>
diff --git a/Runtime/Microsoft.Scripting.Metadata/MemoryMapping.V2.cs b/Runtime/Microsoft.Scripting.Metadata/MemoryMapping.V2.cs index 7ed9bd5..970b163 100644 --- a/Runtime/Microsoft.Scripting.Metadata/MemoryMapping.V2.cs +++ b/Runtime/Microsoft.Scripting.Metadata/MemoryMapping.V2.cs @@ -113,18 +113,20 @@ namespace Microsoft.Scripting.Metadata { RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { fileDescriptor = Syscall.open(path, OpenFlags.O_RDONLY); - if (fileDescriptor < 0) { + if (fileDescriptor > 0) { Stat stat; if (Syscall.fstat(fileDescriptor, out stat) >= 0) { size = unchecked((int)stat.st_size); - mapping._capacity = size; - mapping._pointer = (byte*)Syscall.mmap(IntPtr.Zero, (ulong)size, MmapProts.PROT_READ, MmapFlags.MAP_SHARED, fileDescriptor, 0); + mapping = new MemoryMapping { + _capacity = size, + _pointer = (byte*)Syscall.mmap(IntPtr.Zero, (ulong)size, MmapProts.PROT_READ, MmapFlags.MAP_SHARED, fileDescriptor, 0) + }; } Syscall.close(fileDescriptor); } } - if (mapping._pointer == null) { + if (mapping == null || mapping._pointer == null) { throw new IOException("Unable to create memory map: " + path, Marshal.GetLastWin32Error()); }
_______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core