Ver Fonte

Include System.IO.MemoryMappedFiles in the MOBILE profile

Miguel de Icaza há 14 anos atrás
pai
commit
ee8ad64dc5

+ 1 - 1
mcs/class/System.Core/Makefile

@@ -4,7 +4,7 @@ include ../../build/rules.make
 
 LIBRARY = System.Core.dll
 
-LIB_MCS_FLAGS = -d:INSIDE_SYSCORE -d:LIBC /r:$(corlib) /r:System.dll
+LIB_MCS_FLAGS = -d:INSIDE_SYSCORE -d:LIBC /r:$(corlib) /r:System.dll -unsafe
 
 ifneq (2.1, $(FRAMEWORK_VERSION))
 LIB_MCS_FLAGS += -d:NET_3_5 -nowarn:1720

+ 2 - 2
mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafeMemoryMappedViewHandle.cs

@@ -26,7 +26,7 @@
 // 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;
@@ -50,4 +50,4 @@ namespace Microsoft.Win32.SafeHandles
 	}
 }
 
-#endif
+#endif

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

@@ -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,15 +514,28 @@ 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,
@@ -538,7 +557,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 +641,7 @@ namespace System.IO.MemoryMappedFiles
 			}
 		}
 
+#if !MOBILE
 		[MonoTODO]
 		public MemoryMappedFileSecurity GetAccessControl ()
 		{
@@ -629,6 +653,7 @@ namespace System.IO.MemoryMappedFiles
 		{
 			throw new NotImplementedException ();
 		}
+#endif
 
 		[MonoTODO]
 		public SafeMemoryMappedFileHandle SafeMemoryMappedFileHandle {

+ 58 - 0
mcs/class/System.Core/mobile_System.Core.dll.sources

@@ -75,3 +75,61 @@ System.Threading/ReaderWriterLockSlim.cs
 System.Threading/ThreadLockState.cs
 System.Threading/ReaderWriterLockSlimExtensions.cs
 ../corlib/System.Threading/AtomicBoolean.cs
+System.Linq.Parallel.QueryNodes/QueryBaseNode.cs
+System.Linq.Parallel.QueryNodes/QueryCastNode.cs
+System.Linq.Parallel.QueryNodes/QueryChildNode.cs
+System.Linq.Parallel.QueryNodes/QueryConcatNode.cs
+System.Linq.Parallel.QueryNodes/QueryDefaultEmptyNode.cs
+System.Linq.Parallel.QueryNodes/QueryGroupByNode.cs
+System.Linq.Parallel.QueryNodes/QueryHeadWorkerNode.cs
+System.Linq.Parallel.QueryNodes/QueryJoinNode.cs
+System.Linq.Parallel.QueryNodes/QueryMuxNode.cs
+System.Linq.Parallel.QueryNodes/QueryOptionNode.cs
+System.Linq.Parallel.QueryNodes/QueryOrderByNode.cs
+System.Linq.Parallel.QueryNodes/QueryOrderGuardNode.cs
+System.Linq.Parallel.QueryNodes/QueryOrderedStreamNode.cs
+System.Linq.Parallel.QueryNodes/QueryReverseNode.cs
+System.Linq.Parallel.QueryNodes/QuerySelectManyNode.cs
+System.Linq.Parallel.QueryNodes/QuerySelectNode.cs
+System.Linq.Parallel.QueryNodes/QuerySetNode.cs
+System.Linq.Parallel.QueryNodes/QueryStartNode.cs
+System.Linq.Parallel.QueryNodes/QueryStreamNode.cs
+System.Linq.Parallel.QueryNodes/QueryWhereNode.cs
+System.Linq.Parallel.QueryNodes/QueryZipNode.cs
+System.Linq.Parallel.QueryNodes/SetInclusion.cs
+System.Linq.Parallel.QueryNodes/WrapHelper.cs
+System.Linq.Parallel/AggregationList.cs
+System.Linq.Parallel/ConcurrentGrouping.cs
+System.Linq.Parallel/ConcurrentLookup.cs
+System.Linq.Parallel/INodeVisitor.cs
+System.Linq.Parallel/IVisitableNode.cs
+System.Linq.Parallel/OrderingEnumerator.cs
+System.Linq.Parallel/ParallelExecuter.cs
+System.Linq.Parallel/ParallelPartitioner.cs
+System.Linq.Parallel/ParallelQueryEnumerator.cs
+System.Linq.Parallel/ParallelQuickSort.cs
+System.Linq.Parallel/QueryCheckerVisitor.cs
+System.Linq.Parallel/QueryIsOrderedVisitor.cs
+System.Linq.Parallel/QueryOptions.cs
+System.Linq.Parallel/RangeList.cs
+System.Linq.Parallel/RepeatList.cs
+System.Linq.Parallel/ReverseList.cs
+System.Linq.Parallel/StripPartitioner.cs
+System.Linq/EnumerableExecutor.cs
+System.Linq/EnumerableExecutor_T.cs
+System.Linq/EnumerableQuery.cs
+System.Linq/EnumerableQuery_T.cs
+System.Linq/OrderedParallelQuery.cs
+System.Linq/ParallelEnumerable.cs
+System.Linq/ParallelExecutionMode.cs
+System.Linq/ParallelMergeOptions.cs
+System.Linq/ParallelQuery.cs
+System.IO.MemoryMappedFiles/MemoryMappedFile.cs
+System.IO.MemoryMappedFiles/MemoryMappedFileAccess.cs
+System.IO.MemoryMappedFiles/MemoryMappedFileOptions.cs
+System.IO.MemoryMappedFiles/MemoryMappedFileRights.cs
+System.IO.MemoryMappedFiles/MemoryMappedViewStream.cs
+System.IO.MemoryMappedFiles/MemoryMappedViewAccessor.cs
+Microsoft.Win32.SafeHandles/SafeMemoryMappedFileHandle.cs
+Microsoft.Win32.SafeHandles/SafeMemoryMappedViewHandle.cs
+System.IO/HandleInheritability.cs

+ 1 - 1
mcs/class/corlib/System.IO/UnmanagedMemoryAccessor.cs

@@ -27,7 +27,7 @@
 // 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.Runtime.InteropServices;

+ 10 - 10
mcs/class/corlib/System.IO/UnmanagedMemoryStream.cs

@@ -45,7 +45,7 @@ namespace System.IO
 		IntPtr initial_pointer;
 		long initial_position;
 		long current_position;
-#if NET_4_0
+#if NET_4_0 || MOBILE
 		SafeBuffer safebuffer;
 #endif
 		
@@ -70,7 +70,7 @@ namespace System.IO
 			Initialize (pointer, length, capacity, access);
 		}
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 		public UnmanagedMemoryStream (SafeBuffer buffer, long offset, long length) :
 			this (buffer, offset, length, FileAccess.Read)
 		{
@@ -139,7 +139,7 @@ namespace System.IO
 		[CLSCompliantAttribute (false)]
 		public unsafe byte* PositionPointer {
 			get {
-#if NET_4_0
+#if NET_4_0 || MOBILE
 				if (safebuffer != null)
 					throw new NotSupportedException ("Not supported when using SafeBuffer");
 #endif
@@ -151,7 +151,7 @@ namespace System.IO
 				return (byte *) initial_pointer + current_position;
 			}
 			set {
-#if NET_4_0
+#if NET_4_0 || MOBILE
 				if (safebuffer != null)
 					throw new NotSupportedException ("Not supported when using SafeBuffer");
 #endif
@@ -188,7 +188,7 @@ namespace System.IO
 				return 0;
 
 			int progress = current_position + count < length ? count : (int) (length - current_position);
-#if NET_4_0
+#if NET_4_0 || MOBILE
 			if (safebuffer != null) {
 				unsafe {
 					byte *ptr = null;
@@ -220,7 +220,7 @@ namespace System.IO
 			if (current_position >= length)
 				return (-1);
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 			if (safebuffer != null) {
 				unsafe {
 					byte *ptr = null;
@@ -269,7 +269,7 @@ namespace System.IO
 		 
 		public override void SetLength (long value)
 		{
-#if NET_4_0
+#if NET_4_0 || MOBILE
 			if (safebuffer != null)
 				throw new NotSupportedException ("Not supported when using SafeBuffer");
 #endif
@@ -320,7 +320,7 @@ namespace System.IO
 			if (fileaccess == FileAccess.Read)
 				throw new NotSupportedException ("Stream does not support writing.");
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 			if (safebuffer != null) {
 				unsafe {
 					byte *dest = null;
@@ -360,7 +360,7 @@ namespace System.IO
 			if (fileaccess == FileAccess.Read)
 				throw new NotSupportedException("Stream does not support writing.");
  
-#if NET_4_0
+#if NET_4_0 || MOBILE
 			if (safebuffer != null) {
 				unsafe {
 					byte *dest = null;
@@ -412,7 +412,7 @@ namespace System.IO
 			closed = false;
 		}
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 		protected void Initialize (SafeBuffer buffer, long offset, long length, FileAccess access)
 		{
 			if (buffer == null)

+ 2 - 2
mcs/class/corlib/System.Runtime.InteropServices/SafeBuffer.cs

@@ -26,7 +26,7 @@
 // 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;
@@ -163,4 +163,4 @@ namespace System.Runtime.InteropServices
 	}
 }
 
-#endif
+#endif