* [Coop] ves_icall_System_Threading_Thread_GetDomainID convert to coop/handle.
* [Coop] Convert ves_icall_System_Threading_Thread_ConstructInternalThread to coop/handle.
* [Coop] Convert ves_icall_System_Threading_Thread_Thread_internal to coop/handle.
* [Coop] Convert mono_threads_get_max_stack_size ves_icall_System_Threading_Thread_SystemMaxStackSize/typo SystemMaxStackStize to coop/handle.
* [Coop] Convert ves_icall_System_Threading_Thread_Suspend to coop/handle.
* [Coop] Convert ves_icall_System_Threading_Thread_Sleep_internal to coop/handle.
* [Coop] Convert ves_icall_System_Threading_Thread_SpinWait_nop to coop/handle.
* [Coop] Convert threadpool.c to handles -- no pointers, just MonoError.
* [Coop] Convert ves_icall_System_Threading_InternalThread_Thread_free_internal to coop/handle.
* [Coop] Convert mmap to coop/handle -- where there aren't pointers, just unused errors.
* [Coop] Rename some error to ioerror or win32error.
* [Coop] Convert ves_icall_System_Threading_Thread_current_lcid to coop/handle -- no pointers.
* [Coop] Convert mono_mmap_open_file, mono_mmap_open_handle to coop/handle.
* [Coop] Convert ves_icall_System_Threading_Thread_Yield to coop/handle (no pointers).
* [Coop] Layer ves_icall_System_Threading_Thread_ConstructInternalThread over new mono_thread_construct_internal.
* Ignore out of memory.
* Favor mono_error_set_generic_error over small factories (loss of breakpoint?).
* Restore accidentally lost barrier.
* [Coop] Mostly undo commit d7bdbcc9a2e76913861b69ff106f0bf9573e7ea6
Convert ves_icall_System_Threading_Thread_Sleep_internal to coop/handle.
for now.
It duplicates mono_thread_execute_interruption to mono_thread_execute_interruption_handle
which we want to ensure does not last long.
This should be achieved better by pull
https://github.com/mono/mono/pull/6639
which removes all but one pointer user and leaves
that pointer user layered over handle instead of duplicating.
* [Coop] Fix Windows build.
* [Tailcall][Windows] Add missing error parameter.
Reuse the existing icall infrastructure to give the same handle back.
This PR implements all OpenExisting methods (with the access rights parameter discarded) and the SafeHandle property.
In the runtime, we don't check the capacity parameter if we try to open a mmap file, and we fallthrough the handle refcount case.
This implements the icalls in file-mmap-windows.c used by MemoryMappedFile.
The implementation has been inspired by the CoreFX MemoryMappedFile
implementation.
This patch also fixes a few incompatibilities between .NET and Mono:
* The default MemoryMappedFileOptions has been changed from DelayAllocatePages
to None.
* mono_pagesize() on Windows now return SYSTEM_INFO.dwPageSize, the same as
.NET and CoreFX.
* Added mono_valloc_granule() which returns
SYSTEM_INFO.dwAllocationGranularity and changed mono-codeman.c to use it
when trying to allocate adjacent virtual memory.
* MemoryMappedFileTest has been updated to succeed on .NET.
* A test has been added to test correct DelayAllocatePages behavior (only
supported on Mono on Windows, the flag is ignored on other platforms).
* The posix MemoryMappedFile code has been changed to throw
UnauthorizedAccessException rather than IOException when trying to create a
view outside of the bounds of a MemoryMappedFile.
* Creating a named mapping larger than 4GB on 32-bit systems now throws
ArgumentOutOfRangeException.
Changed MemoryMappedFile related code to use reference source
MemoryMappedViewAccessor and MemoryMappedViewStream.
This change was motivated by segmentations faults while dnmv code was
calling a CoreFX class that uses reflection to call MemoryMappedFile
code.
Now that we are using more code from reference sources there should be
no problem.
Fixes#30741 and #30825.
This patch includes a few fixes:
* CreateNew will actually create a memory map file, the previous logic
in MemoryMapImpl.Open was wrong, and would fail if the file did not
exist. We now cope with this (bug #20052 was caused by this).
* Some exceptions were wrong, so this patch updates the
exceptions being thrown to be the right ones
* On Mobile, we inverted the logic to ensure that capacity must be
bigger or equal than the file size (which is what the API needs to do),
previously it performed the opposite test.
Added tests that match the behavior on .NET for this.
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