Commit Graph
28 Commits
Author SHA1 Message Date
Marek Safar 4660f44381 [system.core] Fix some MemoryMappedFile argument checks 2014-05-07 14:19:57 +02:00
Marek Safar 323f0816f4 Add missing types and methods 2014-03-11 23:22:16 +01:00
Alex Rønne Petersen d8feb5e9ad 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.
2014-01-06 21:41:48 +01:00
Jonathan Pryor 0e7dc370e3 [System.Core/Android] Android's libc.so doesn't export getpagesize()
Partially fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=12739

Android's libc.so doesn't export getpagesize(3), resulting in an
EntryPointNotFoundException:

	System.EntryPointNotFoundException: getpagesize
	  at (wrapper managed-to-native) System.IO.MemoryMappedFiles.MemoryMapImpl.getpagesize ()
	  at System.IO.MemoryMappedFiles.MemoryMapImpl.Map (int,long,long&,System.IO.MemoryMappedFiles.MemoryMappedFileAccess,intptr&,int&)
	  at System.IO.MemoryMappedFiles.MemoryMappedViewAccessor.Create (long,long,System.IO.MemoryMappedFiles.MemoryMappedFileAccess)
	  at System.IO.MemoryMappedFiles.MemoryMappedViewAccessor..ctor (int,long,long,System.IO.MemoryMappedFiles.MemoryMappedFileAccess)
	  at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateViewAccessor (long,long,System.IO.MemoryMappedFiles.MemoryMappedFileAccess)

Android does provide getpagesize(3); it's just an inline function.

The full fix will require two parts:

 1. Update MemoryMapImpl to P/Invoke
    libmonodroid.so!monodroid_getpagesize()
 2. Add a libmonodroid.so!monodroid_getpagesize() export.

This commit implements (1).
2013-08-12 16:59:14 -04:00
Rodrigo Kumpera 1b92a4148c Since MOBILE implies NET_4_* now, take this into account and simplify our ifdefs. 2013-02-11 18:42:18 -05:00
Sebastien Pouliot 52852db613 Use same name/casing for DllImport so we do not duplicate needlessly the extern entries in the metadata 2012-11-06 19:08:39 -05:00
James Bellinger 9322e0d16b ACLs now work on Windows. Tests all the way up to DirectorySecurityTest and FileSecurityTest.
NativeObjectSecurity is implemented.
I've done it in such a way that, for OSes that do not have a unified API for all ACLs,
overrides can be done in subclasses such as FileSystemSecurity without trouble.

ObjectSecurity, CommonObjectSecurity, and DirectoryObjectSecurity all implemented.
MutexSecurity, PipeSecurity, etc. all just add type specialization and nothing else. Implemented all of these as well.

Access and Audit rules now correctly use NTAccount in their string overloads (see unit tests).
The constructors all provide correct AccessMasks now. In other words, these classes are all now un-broken/no longer stubs.

More unit tests for CommonSecurityDescriptor and fixes to pass them.
A few had checks that were redundant (implemented by (Authorization|Audit|Access)Rule) as well. These have been removed.
The Allow Everyone Full Access default for null DiscretionaryAcls in CommonSecurityDescriptor is, I think,
properly implemented. This required some changes to GenericSecurityDescriptor as well, but now Mono matches
MS.NET on GetSddl/GetBinaryForm for null DiscretionaryAcl including roundtrip.

What's still missing:
(1) CommonAcl's RemoveAccess/RemoveAudit. RemoveAll and RemoveSpecific work so it's not a big issue.
(2) CommonAcl merging will not yet try to merge a CommonAce together with an ObjectAce.
(3) The various *Security constructors. Get/SetAccessControl work on files and directories.
However, you still have to create and then set. I am not too familiar with Mono runtime internal
calls, but to someone who is: If the SECURITY_ATTRIBUTES parameter to Create*'s lpSecurityDescriptor
pointed to the output of GenericSecurityDescriptor's GetBinaryForm, that would be a complete
implementation.
2012-07-07 18:45:06 -04:00
Rob Wilkens 8fe578747d Fixes a problem that was preventing mono from compiling
Somehow the compiler became more strict, and a not-implemented class is now
causing mono to fail to build.

The attached patch doesn't really fix anything besides letting it compile.

I was nice enough to throw a NotImplementedException() on the default
constructor.

The compile time error was:
System.IO.MemoryMappedFiles/MemoryMappedFileSecurity.cs(35,15): error CS0122:
`System.Security.AccessControl.ObjectSecurity
<System.IO.MemoryMappedFiles.MemoryMappedFileRights>.ObjectSecurity()' is
inaccessible due to its protection level

Feel free to reject this patch if I am the only one seeing this problem (on
Linux x86_64 build) after most recent git clone of mono/master.
2012-07-01 22:02:21 -04:00
Zoltan Varga de60ac57fb Fix the build. 2011-12-03 01:12:23 +01:00
Miguel de Icaza ee8ad64dc5 Include System.IO.MemoryMappedFiles in the MOBILE profile 2011-12-02 13:15:37 -05:00
Rodrigo Kumpera b2f29e14ba Implement a mobile ready version of memory mapped files. 2011-11-03 12:13:28 -02:00
Rodrigo Kumpera 60b9bc64ab Move all Mono.Unix deps into a single place and put a skeleton of MOBILE support for mmap'd files. 2011-11-03 12:13:27 -02:00
Marek Safar 81cf39742a Update few constant values 2011-10-07 10:11:30 +01:00
Marek Safar bd05c6c836 Some .net 4.0 api compatibility fixes 2010-12-15 11:12:07 +00:00
Marek Safar aad016fd87 Clean up few more warnings 2010-10-15 15:20:25 +01:00
Jb Evain 2f29080c3f 2010-05-25 Jb Evain <[email protected]>
* MemoryMappedViewAccessor.cs: fix API.


svn path=/trunk/mcs/; revision=157852
2010-05-25 13:59:46 +00:00
Jb Evain b34661184e 2010-05-25 Jb Evain <[email protected]>
* MemoryMappedFile.cs: add missing overloads.


svn path=/trunk/mcs/; revision=157850
2010-05-25 13:51:40 +00:00
Jb Evain 67cb3134c4 2010-05-25 Jb Evain <[email protected]>
* MemoryMappedFile.cs: make some helper methods private.


svn path=/trunk/mcs/; revision=157847
2010-05-25 13:37:35 +00:00
Jb Evain 2e8968f23e 2010-05-25 Jb Evain <[email protected]>
* MemoryMappedFileSecurity.cs: ifdef for NET_4_0.


svn path=/trunk/mcs/; revision=157846
2010-05-25 13:37:05 +00:00
Jb Evain 401a69270a 2010-04-15 Jb Evain <[email protected]>
* MemoryMappedFile.cs: implement CreateOrOpen.


svn path=/trunk/mcs/; revision=155494
2010-04-15 11:49:37 +00:00
Jb Evain 1a85aa1d2a eol
svn path=/trunk/mcs/; revision=155493
2010-04-15 11:49:13 +00:00
Jb Evain 259e22f6ee 2010-04-14 Jb Evain <[email protected]>
* MemoryMappedViewAccessor.cs
	* MemoryMappedFile.cs
	* MemoryMappedViewStream.cs:
		Properly retrieve the size of the mmapped file. Fixes the
		unit tests.


svn path=/trunk/mcs/; revision=155407
2010-04-14 16:38:53 +00:00
Miguel de Icaza 953f560654 2009-12-14 Miguel de Icaza <[email protected]>
* MemoryMappedFile.cs: Make this by default use the native
        interface (Mono.Unix.Native.Syscall) to map files and only support
        the FileStream.Handle when the user explicitly uses this API.

        The reason is that currently the code depends on the io-layer
        keeping parity between our handles and Unix file descriptors, this
        removes this dependency for most cases. 


svn path=/trunk/mcs/; revision=148366
2009-12-14 05:24:34 +00:00
Miguel de Icaza 76574e8f58 2009-12-13 Miguel de Icaza <[email protected]>
* SafeMemoryMappedViewHandle.cs (ReleaseHandle): implement. 

2009-12-13  Miguel de Icaza  <[email protected]>

        * MemoryMappedViewAccessor.cs: Derive from
        UnmanagedMemoryAccessor, remove explicit IDisposable
inheritance.
        (CreatePosix): Call Initialize on the base class to initialize. 
        (Dispose): Kill methods. 
        (Flush): Add.
        (MapPosix): no need to return out mmap_size, it is always size.

        * MemoryMappedFile.cs: Add FlushPosix.

        * MemoryMappedViewStream.cs: Update API.


svn path=/trunk/mcs/; revision=148361
2009-12-14 01:40:50 +00:00
Miguel de Icaza 04db5e3842 2009-12-10 Miguel de Icaza <[email protected]>
* MemoryMappedFile.cs: Updated to the new Beta API, fill in some
	blanks, map some new flags, obey some settings, throw some
	exceptions. 

svn path=/trunk/mcs/; revision=148003
2009-12-10 05:55:57 +00:00
Zoltan Varga 08351b9b95 2009-09-05 Zoltan Varga <[email protected]>
* MemoryMappedViewAccessor.cs: New net 4.0 class.

	* MemoryMappedViewStream.cs: Move the mmap code to MemoryMappedFile.cs,
	so it can be used by ViewAccessor as well.

svn path=/trunk/mcs/; revision=141375
2009-09-04 22:22:58 +00:00
Zoltan Varga 1994c7d03b 2009-08-30 Zoltan Varga <[email protected]>
* MemoryMappedViewStream.cs: Implement this for unix.

svn path=/trunk/mcs/; revision=140930
2009-08-29 23:59:13 +00:00
Zoltan Varga 4174126774 2009-08-29 Zoltan Varga <[email protected]>
* net_4_0_System.Core.dll.sources: Add System.IO.MemoryMappedFiles/*.cs
	and Microsoft.Win32.SafeHandles/SafeMemoryMappedFileHandle.cs.

svn path=/trunk/mcs/; revision=140929
2009-08-29 23:59:04 +00:00