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).
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.
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.
* MemoryMappedViewAccessor.cs
* MemoryMappedFile.cs
* MemoryMappedViewStream.cs:
Properly retrieve the size of the mmapped file. Fixes the
unit tests.
svn path=/trunk/mcs/; revision=155407
* 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
* 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
* 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
* 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