Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs/class
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alexrp@xamarin.com>2014-01-07 00:41:48 +0400
committerAlex Rønne Petersen <alexrp@xamarin.com>2014-01-07 00:41:48 +0400
commitd8feb5e9adcc10e6733aedcc6aecee98b1a7c308 (patch)
treeeb2ae44234df89e291b4d3ec16fb2bc3e3e9ddaa /mcs/class
parenteae1c9cb84b975eba14b6368cd3c2d51b798dbdc (diff)
Allow creating MemoryMappedFiles with an in-memory and on-disk capacity of zero on Unix.
This is necessary to map special files such as /dev/mem.
Diffstat (limited to 'mcs/class')
-rw-r--r--mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs6
1 files changed, 3 insertions, 3 deletions
diff --git a/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs b/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs
index 014cde469fa..21faf963a70 100644
--- a/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs
+++ b/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs
@@ -124,7 +124,7 @@ namespace System.IO.MemoryMappedFiles
if (Syscall.stat (path, out buf) == -1)
UnixMarshal.ThrowExceptionForLastError ();
- if ((capacity == 0 && buf.st_size == 0) || (capacity > buf.st_size))
+ if (capacity > buf.st_size)
throw new ArgumentException ("capacity");
int fd = Syscall.open (path, ToUnixMode (mode) | ToUnixMode (access), FilePermissions.DEFFILEMODE);
@@ -369,7 +369,7 @@ namespace System.IO.MemoryMappedFiles
if (file_size < 0)
throw new FileNotFoundException (path);
- if ((capacity == 0 && file_size == 0) || (capacity > file_size))
+ if (capacity > file_size)
throw new ArgumentException ("capacity");
int fd = open (path, ToUnixMode (mode) | ToUnixMode (access), DEFFILEMODE);
@@ -507,7 +507,7 @@ namespace System.IO.MemoryMappedFiles
throw new ArgumentNullException ("fileStream");
if (mapName != null && mapName.Length == 0)
throw new ArgumentException ("mapName");
- if ((capacity == 0 && fileStream.Length == 0) || (capacity > fileStream.Length))
+ if ((!MonoUtil.IsUnix && capacity == 0 && fileStream.Length == 0) || (capacity > fileStream.Length))
throw new ArgumentException ("capacity");
MemoryMapImpl.ConfigureFD (fileStream.Handle, inheritability);