From 528e91dabff1d64587b31c5954942b23d8678ae4 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Wed, 18 Apr 2018 01:05:44 +0200 Subject: [PATCH] Replace identical files with CoreLib mirror (dotnet/corefx#28593) Commit migrated from https://github.com/dotnet/corefx/commit/5041dbb272ae05b360db538cf62fc2847277fd7e --- .../Common/src/Interop/Unix/Interop.IOErrors.cs | 172 ------------------- .../Interop/Unix/System.Native/Interop.Close.cs | 15 -- .../Interop/Unix/System.Native/Interop.FLock.cs | 31 ---- .../Interop/Unix/System.Native/Interop.FSync.cs | 15 -- .../Unix/System.Native/Interop.FTruncate.cs | 15 -- .../Interop/Unix/System.Native/Interop.GetCwd.cs | 74 -------- .../Interop/Unix/System.Native/Interop.LSeek.cs | 22 --- .../Interop/Unix/System.Native/Interop.MksTemps.cs | 17 -- .../src/Interop/Unix/System.Native/Interop.Open.cs | 15 -- .../Unix/System.Native/Interop.OpenFlags.cs | 27 --- .../Interop/Unix/System.Native/Interop.PathConf.cs | 28 --- .../Unix/System.Native/Interop.Permissions.cs | 32 ---- .../Unix/System.Native/Interop.PosixFAdvise.cs | 36 ---- .../src/Interop/Unix/System.Native/Interop.Read.cs | 25 --- .../Interop/Unix/System.Native/Interop.ReadLink.cs | 63 ------- .../src/Interop/Unix/System.Native/Interop.Stat.cs | 65 ------- .../Interop/Unix/System.Native/Interop.SysLog.cs | 58 ------- .../Interop/Unix/System.Native/Interop.Unlink.cs | 15 -- .../Interop/Unix/System.Native/Interop.Write.cs | 27 --- .../Common/src/Interop/Windows/Interop.BOOL.cs | 21 --- .../Interop/Windows/kernel32/Interop.CancelIoEx.cs | 16 -- .../Windows/kernel32/Interop.CloseHandle.cs | 16 -- .../Windows/kernel32/Interop.FileAttributes.cs | 17 -- .../Windows/kernel32/Interop.FlushFileBuffers.cs | 17 -- .../kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs | 21 --- ...Interop.ReadFile_SafeHandle_NativeOverlapped.cs | 22 --- .../Windows/kernel32/Interop.SecurityOptions.cs | 18 -- .../Windows/kernel32/Interop.SetEndOfFile.cs | 15 -- .../Windows/kernel32/Interop.SetFilePointerEx.cs | 15 -- .../Interop.WriteFile_SafeHandle_IntPtr.cs | 24 --- ...nterop.WriteFile_SafeHandle_NativeOverlapped.cs | 22 --- .../Win32/SafeHandles/SafeDirectoryHandle.Unix.cs | 26 --- .../src/System/IO/StreamHelpers.CopyValidation.cs | 46 ----- .../Common/src/System/Threading/Tasks/TaskToApm.cs | 189 --------------------- src/libraries/Common/tests/Common.Tests.csproj | 8 +- .../src/CoreFx.Private.TestUtilities.csproj | 10 +- .../src/Microsoft.Win32.Registry.csproj | 6 +- .../src/System.Collections.csproj | 10 +- .../Collections/Generic/ICollectionDebugView.cs | 34 ---- .../Collections/Generic/IDictionaryDebugView.cs | 80 --------- .../System.Console/src/System.Console.csproj | 26 +-- .../src/System.Data.SqlClient.csproj | 10 +- .../src/System.Diagnostics.EventLog.csproj | 6 +- .../src/System.Diagnostics.FileVersionInfo.csproj | 4 +- .../System.Diagnostics.PerformanceCounter.csproj | 6 +- .../src/System.Diagnostics.Process.csproj | 18 +- .../src/System.IO.Compression.Brotli.csproj | 6 +- .../System.IO.Compression.Brotli.Tests.csproj | 6 +- .../src/System.IO.Compression.csproj | 14 +- .../tests/System.IO.Compression.Tests.csproj | 6 +- .../src/System.IO.FileSystem.DriveInfo.csproj | 10 +- .../src/System.IO.FileSystem.Watcher.csproj | 18 +- .../src/System.IO.FileSystem.csproj | 32 ++-- .../src/System/IO/DisableMediaInsertionPrompt.cs | 36 ---- .../src/System.IO.MemoryMappedFiles.csproj | 26 +-- .../System.IO.Pipes/src/System.IO.Pipes.csproj | 46 ++--- .../System.IO.Ports/src/System.IO.Ports.csproj | 30 ++-- .../src/System.Net.Http.WinHttpHandler.csproj | 6 +- .../src/System.Net.Http.WinHttpHandler.msbuild | 2 +- ...ystem.Net.Http.WinHttpHandler.Unit.Tests.csproj | 10 +- .../System.Net.Http/src/System.Net.Http.csproj | 38 ++--- .../UnitTests/System.Net.Http.Unit.Tests.csproj | 10 +- .../src/System.Net.HttpListener.csproj | 16 +- .../System.Net.Mail/src/System.Net.Mail.csproj | 6 +- .../src/System.Net.NameResolution.csproj | 4 +- .../System.Net.NameResolution.Pal.Tests.csproj | 4 +- .../src/System.Net.NetworkInformation.csproj | 6 +- .../System.Net.Ping/src/System.Net.Ping.csproj | 6 +- .../src/System.Net.Requests.csproj | 6 +- .../src/System.Net.Security.csproj | 10 +- .../System.Net.Security.Tests.csproj | 6 +- .../src/System.Net.Sockets.csproj | 14 +- .../System.Net.Sockets.Tests.csproj | 6 +- .../src/System.Runtime.Extensions.csproj | 30 ++-- .../src/System.Security.AccessControl.csproj | 4 +- .../System.Security.Cryptography.Primitives.csproj | 6 +- ...m.Security.Cryptography.X509Certificates.csproj | 12 +- ...rity.Cryptography.X509Certificates.Tests.csproj | 10 +- .../src/System.Security.Principal.Windows.csproj | 4 +- .../System/Threading/DeferredDisposableLifetime.cs | 116 ------------- 80 files changed, 260 insertions(+), 1757 deletions(-) delete mode 100644 src/libraries/Common/src/Interop/Unix/Interop.IOErrors.cs delete mode 100644 src/libraries/Common/src/Interop/Unix/System.Native/Interop.Close.cs delete mode 100644 src/libraries/Common/src/Interop/Unix/System.Native/Interop.FLock.cs delete mode 100644 src/libraries/Common/src/Interop/Unix/System.Native/Interop.FSync.cs delete mode 100644 src/libraries/Common/src/Interop/Unix/System.Native/Interop.FTruncate.cs delete mode 100644 src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetCwd.cs delete mode 100644 src/libraries/Common/src/Interop/Unix/System.Native/Interop.LSeek.cs delete mode 100644 src/libraries/Common/src/Interop/Unix/System.Native/Interop.MksTemps.cs delete mode 100644 src/libraries/Common/src/Interop/Unix/System.Native/Interop.Open.cs delete mode 100644 src/libraries/Common/src/Interop/Unix/System.Native/Interop.OpenFlags.cs delete mode 100644 src/libraries/Common/src/Interop/Unix/System.Native/Interop.PathConf.cs delete mode 100644 src/libraries/Common/src/Interop/Unix/System.Native/Interop.Permissions.cs delete mode 100644 src/libraries/Common/src/Interop/Unix/System.Native/Interop.PosixFAdvise.cs delete mode 100644 src/libraries/Common/src/Interop/Unix/System.Native/Interop.Read.cs delete mode 100644 src/libraries/Common/src/Interop/Unix/System.Native/Interop.ReadLink.cs delete mode 100644 src/libraries/Common/src/Interop/Unix/System.Native/Interop.Stat.cs delete mode 100644 src/libraries/Common/src/Interop/Unix/System.Native/Interop.SysLog.cs delete mode 100644 src/libraries/Common/src/Interop/Unix/System.Native/Interop.Unlink.cs delete mode 100644 src/libraries/Common/src/Interop/Unix/System.Native/Interop.Write.cs delete mode 100644 src/libraries/Common/src/Interop/Windows/Interop.BOOL.cs delete mode 100644 src/libraries/Common/src/Interop/Windows/kernel32/Interop.CancelIoEx.cs delete mode 100644 src/libraries/Common/src/Interop/Windows/kernel32/Interop.CloseHandle.cs delete mode 100644 src/libraries/Common/src/Interop/Windows/kernel32/Interop.FileAttributes.cs delete mode 100644 src/libraries/Common/src/Interop/Windows/kernel32/Interop.FlushFileBuffers.cs delete mode 100644 src/libraries/Common/src/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs delete mode 100644 src/libraries/Common/src/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs delete mode 100644 src/libraries/Common/src/Interop/Windows/kernel32/Interop.SecurityOptions.cs delete mode 100644 src/libraries/Common/src/Interop/Windows/kernel32/Interop.SetEndOfFile.cs delete mode 100644 src/libraries/Common/src/Interop/Windows/kernel32/Interop.SetFilePointerEx.cs delete mode 100644 src/libraries/Common/src/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs delete mode 100644 src/libraries/Common/src/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs delete mode 100644 src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeDirectoryHandle.Unix.cs delete mode 100644 src/libraries/Common/src/System/IO/StreamHelpers.CopyValidation.cs delete mode 100644 src/libraries/Common/src/System/Threading/Tasks/TaskToApm.cs delete mode 100644 src/libraries/System.Collections/src/System/Collections/Generic/ICollectionDebugView.cs delete mode 100644 src/libraries/System.Collections/src/System/Collections/Generic/IDictionaryDebugView.cs delete mode 100644 src/libraries/System.IO.FileSystem/src/System/IO/DisableMediaInsertionPrompt.cs delete mode 100644 src/libraries/System.Threading.Overlapped/src/System/Threading/DeferredDisposableLifetime.cs diff --git a/src/libraries/Common/src/Interop/Unix/Interop.IOErrors.cs b/src/libraries/Common/src/Interop/Unix/Interop.IOErrors.cs deleted file mode 100644 index 5babcd1..0000000 --- a/src/libraries/Common/src/Interop/Unix/Interop.IOErrors.cs +++ /dev/null @@ -1,172 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Diagnostics; -using System.IO; -using System.Runtime.InteropServices; -using Microsoft.Win32.SafeHandles; - -internal static partial class Interop -{ - private static void ThrowExceptionForIoErrno(ErrorInfo errorInfo, string path, bool isDirectory, Func errorRewriter) - { - Debug.Assert(errorInfo.Error != Error.SUCCESS); - Debug.Assert(errorInfo.Error != Error.EINTR, "EINTR errors should be handled by the native shim and never bubble up to managed code"); - - if (errorRewriter != null) - { - errorInfo = errorRewriter(errorInfo); - } - - throw Interop.GetExceptionForIoErrno(errorInfo, path, isDirectory); - } - - internal static void CheckIo(Error error, string path = null, bool isDirectory = false, Func errorRewriter = null) - { - if (error != Interop.Error.SUCCESS) - { - ThrowExceptionForIoErrno(error.Info(), path, isDirectory, errorRewriter); - } - } - - /// - /// Validates the result of system call that returns greater than or equal to 0 on success - /// and less than 0 on failure, with errno set to the error code. - /// If the system call failed for any reason, an exception is thrown. Otherwise, the system call succeeded. - /// - /// The result of the system call. - /// The path with which this error is associated. This may be null. - /// true if the is known to be a directory; otherwise, false. - /// Optional function to change an error code prior to processing it. - /// - /// On success, returns the non-negative result long that was validated. - /// - internal static long CheckIo(long result, string path = null, bool isDirectory = false, Func errorRewriter = null) - { - if (result < 0) - { - ThrowExceptionForIoErrno(Sys.GetLastErrorInfo(), path, isDirectory, errorRewriter); - } - - return result; - } - - /// - /// Validates the result of system call that returns greater than or equal to 0 on success - /// and less than 0 on failure, with errno set to the error code. - /// If the system call failed for any reason, an exception is thrown. Otherwise, the system call succeeded. - /// - /// - /// On success, returns the non-negative result int that was validated. - /// - internal static int CheckIo(int result, string path = null, bool isDirectory = false, Func errorRewriter = null) - { - CheckIo((long)result, path, isDirectory, errorRewriter); - - return result; - } - - /// - /// Validates the result of system call that returns greater than or equal to 0 on success - /// and less than 0 on failure, with errno set to the error code. - /// If the system call failed for any reason, an exception is thrown. Otherwise, the system call succeeded. - /// - /// - /// On success, returns the non-negative result IntPtr that was validated. - /// - internal static IntPtr CheckIo(IntPtr result, string path = null, bool isDirectory = false, Func errorRewriter = null) - { - CheckIo((long)result, path, isDirectory, errorRewriter); - - return result; - } - - /// - /// Validates the result of system call that returns greater than or equal to 0 on success - /// and less than 0 on failure, with errno set to the error code. - /// If the system call failed for any reason, an exception is thrown. Otherwise, the system call succeeded. - /// - /// - /// On success, returns the valid SafeFileHandle that was validated. - /// - internal static TSafeHandle CheckIo(TSafeHandle handle, string path = null, bool isDirectory = false, Func errorRewriter = null) - where TSafeHandle : SafeHandle - { - if (handle.IsInvalid) - { - ThrowExceptionForIoErrno(Sys.GetLastErrorInfo(), path, isDirectory, errorRewriter); - } - - return handle; - } - - /// - /// Gets an Exception to represent the supplied error info. - /// - /// The error info - /// The path with which this error is associated. This may be null. - /// true if the is known to be a directory; otherwise, false. - /// - internal static Exception GetExceptionForIoErrno(ErrorInfo errorInfo, string path = null, bool isDirectory = false) - { - // Translate the errno into a known set of exception types. For cases where multiple errnos map - // to the same exception type, include an inner exception with the details. - switch (errorInfo.Error) - { - case Error.ENOENT: - if (isDirectory) - { - return !string.IsNullOrEmpty(path) ? - new DirectoryNotFoundException(SR.Format(SR.IO_PathNotFound_Path, path)) : - new DirectoryNotFoundException(SR.IO_PathNotFound_NoPathName); - } - else - { - return !string.IsNullOrEmpty(path) ? - new FileNotFoundException(SR.Format(SR.IO_FileNotFound_FileName, path), path) : - new FileNotFoundException(SR.IO_FileNotFound); - } - - case Error.EACCES: - case Error.EBADF: - case Error.EPERM: - Exception inner = GetIOException(errorInfo); - return !string.IsNullOrEmpty(path) ? - new UnauthorizedAccessException(SR.Format(SR.UnauthorizedAccess_IODenied_Path, path), inner) : - new UnauthorizedAccessException(SR.UnauthorizedAccess_IODenied_NoPathName, inner); - - case Error.ENAMETOOLONG: - return !string.IsNullOrEmpty(path) ? - new PathTooLongException(SR.Format(SR.IO_PathTooLong_Path, path)) : - new PathTooLongException(SR.IO_PathTooLong); - - case Error.EWOULDBLOCK: - return !string.IsNullOrEmpty(path) ? - new IOException(SR.Format(SR.IO_SharingViolation_File, path), errorInfo.RawErrno) : - new IOException(SR.IO_SharingViolation_NoFileName, errorInfo.RawErrno); - - case Error.ECANCELED: - return new OperationCanceledException(); - - case Error.EFBIG: - return new ArgumentOutOfRangeException("value", SR.ArgumentOutOfRange_FileLengthTooBig); - - case Error.EEXIST: - if (!string.IsNullOrEmpty(path)) - { - return new IOException(SR.Format(SR.IO_FileExists_Name, path), errorInfo.RawErrno); - } - goto default; - - default: - return GetIOException(errorInfo); - } - } - - internal static Exception GetIOException(Interop.ErrorInfo errorInfo) - { - return new IOException(errorInfo.GetErrorMessage(), errorInfo.RawErrno); - } -} diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.Close.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.Close.cs deleted file mode 100644 index 8d19239..0000000 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.Close.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Sys - { - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Close", SetLastError = true)] - internal static extern int Close(IntPtr fd); - } -} diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.FLock.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.FLock.cs deleted file mode 100644 index 22934a3..0000000 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.FLock.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Runtime.InteropServices; -using Microsoft.Win32.SafeHandles; - -internal static partial class Interop -{ - internal static partial class Sys - { - internal enum LockOperations : int - { - LOCK_SH = 1, /* shared lock */ - LOCK_EX = 2, /* exclusive lock */ - LOCK_NB = 4, /* don't block when locking*/ - LOCK_UN = 8, /* unlock */ - } - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FLock", SetLastError = true)] - internal static extern int FLock(SafeFileHandle fd, LockOperations operation); - - /// - /// Exposing this for SafeFileHandle.ReleaseHandle() to call. - /// Normal callers should use FLock(SafeFileHandle fd). - /// - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FLock", SetLastError = true)] - internal static extern int FLock(IntPtr fd, LockOperations operation); - } -} diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.FSync.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.FSync.cs deleted file mode 100644 index e3ab970..0000000 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.FSync.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Runtime.InteropServices; -using Microsoft.Win32.SafeHandles; - -internal static partial class Interop -{ - internal static partial class Sys - { - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FSync", SetLastError = true)] - internal static extern int FSync(SafeFileHandle fd); - } -} diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.FTruncate.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.FTruncate.cs deleted file mode 100644 index 5dad650..0000000 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.FTruncate.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Runtime.InteropServices; -using Microsoft.Win32.SafeHandles; - -internal static partial class Interop -{ - internal static partial class Sys - { - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FTruncate", SetLastError = true)] - internal static extern int FTruncate(SafeFileHandle fd, long length); - } -} diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetCwd.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetCwd.cs deleted file mode 100644 index c058784..0000000 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetCwd.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Buffers; -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Sys - { - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetCwd", SetLastError = true)] - private static extern unsafe byte* GetCwd(byte* buffer, int bufferLength); - - internal static unsafe string GetCwd() - { - const int StackLimit = 256; - - // First try to get the path into a buffer on the stack - byte* stackBuf = stackalloc byte[StackLimit]; - string result = GetCwdHelper(stackBuf, StackLimit); - if (result != null) - { - return result; - } - - // If that was too small, try increasing large buffer sizes - int bufferSize = StackLimit; - do - { - checked { bufferSize *= 2; } - byte[] buf = ArrayPool.Shared.Rent(bufferSize); - try - { - fixed (byte* ptr = &buf[0]) - { - result = GetCwdHelper(ptr, buf.Length); - if (result != null) - { - return result; - } - } - } - finally - { - ArrayPool.Shared.Return(buf); - } - } - while (true); - } - - private static unsafe string GetCwdHelper(byte* ptr, int bufferSize) - { - // Call the real getcwd - byte* result = GetCwd(ptr, bufferSize); - - // If it returned non-null, the null-terminated path is in the buffer - if (result != null) - { - return Marshal.PtrToStringAnsi((IntPtr)ptr); - } - - // Otherwise, if it failed due to the buffer being too small, return null; - // for anything else, throw. - ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); - if (errorInfo.Error == Interop.Error.ERANGE) - { - return null; - } - throw Interop.GetExceptionForIoErrno(errorInfo); - } - } -} \ No newline at end of file diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.LSeek.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.LSeek.cs deleted file mode 100644 index 7f8df7c..0000000 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.LSeek.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Runtime.InteropServices; -using Microsoft.Win32.SafeHandles; - -internal static partial class Interop -{ - internal static partial class Sys - { - internal enum SeekWhence - { - SEEK_SET = 0, - SEEK_CUR = 1, - SEEK_END = 2 - } - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LSeek", SetLastError = true)] - internal static extern long LSeek(SafeFileHandle fd, long offset, SeekWhence whence); - } -} diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.MksTemps.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.MksTemps.cs deleted file mode 100644 index b8694d9..0000000 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.MksTemps.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Sys - { - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_MksTemps", SetLastError = true)] - internal static extern IntPtr MksTemps( - byte[] template, - int suffixlen); - } -} diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.Open.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.Open.cs deleted file mode 100644 index a9a994c..0000000 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.Open.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Runtime.InteropServices; -using Microsoft.Win32.SafeHandles; - -internal static partial class Interop -{ - internal static partial class Sys - { - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Open", SetLastError = true)] - internal static extern SafeFileHandle Open(string filename, OpenFlags flags, int mode); - } -} diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.OpenFlags.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.OpenFlags.cs deleted file mode 100644 index f9e54c3..0000000 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.OpenFlags.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -internal static partial class Interop -{ - internal static partial class Sys - { - [Flags] - internal enum OpenFlags - { - // Access modes (mutually exclusive) - O_RDONLY = 0x0000, - O_WRONLY = 0x0001, - O_RDWR = 0x0002, - - // Flags (combinable) - O_CLOEXEC = 0x0010, - O_CREAT = 0x0020, - O_EXCL = 0x0040, - O_TRUNC = 0x0080, - O_SYNC = 0x0100, - } - } -} diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.PathConf.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.PathConf.cs deleted file mode 100644 index 7213cb0..0000000 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.PathConf.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Sys - { - internal enum PathConfName : int - { - PC_LINK_MAX = 1, - PC_MAX_CANON = 2, - PC_MAX_INPUT = 3, - PC_NAME_MAX = 4, - PC_PATH_MAX = 5, - PC_PIPE_BUF = 6, - PC_CHOWN_RESTRICTED = 7, - PC_NO_TRUNC = 8, - PC_VDISABLE = 9, - } - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_PathConf", SetLastError = true)] - private static extern int PathConf(string path, PathConfName name); - } -} diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.Permissions.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.Permissions.cs deleted file mode 100644 index f1d1378..0000000 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.Permissions.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -internal static partial class Interop -{ - internal static partial class Sys - { - [Flags] - internal enum Permissions - { - Mask = S_IRWXU | S_IRWXG | S_IRWXO, - - S_IRWXU = S_IRUSR | S_IWUSR | S_IXUSR, - S_IRUSR = 0x100, - S_IWUSR = 0x80, - S_IXUSR = 0x40, - - S_IRWXG = S_IRGRP | S_IWGRP | S_IXGRP, - S_IRGRP = 0x20, - S_IWGRP = 0x10, - S_IXGRP = 0x8, - - S_IRWXO = S_IROTH | S_IWOTH | S_IXOTH, - S_IROTH = 0x4, - S_IWOTH = 0x2, - S_IXOTH = 0x1, - } - } -} diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.PosixFAdvise.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.PosixFAdvise.cs deleted file mode 100644 index ad8b73a..0000000 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.PosixFAdvise.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Runtime.InteropServices; -using Microsoft.Win32.SafeHandles; - -internal static partial class Interop -{ - internal static partial class Sys - { - internal enum FileAdvice : int - { - POSIX_FADV_NORMAL = 0, /* no special advice, the default value */ - POSIX_FADV_RANDOM = 1, /* random I/O access */ - POSIX_FADV_SEQUENTIAL = 2, /* sequential I/O access */ - POSIX_FADV_WILLNEED = 3, /* will need specified pages */ - POSIX_FADV_DONTNEED = 4, /* don't need the specified pages */ - POSIX_FADV_NOREUSE = 5, /* data will only be accessed once */ - } - - /// - /// Notifies the OS kernel that the specified file will be accessed in a particular way soon; this allows the kernel to - /// potentially optimize the access pattern of the file. - /// - /// The file descriptor of the file - /// The start of the region to advise about - /// The number of bytes of the region (until the end of the file if 0) - /// The type of advice to give the kernel about the specified region - /// - /// Returns 0 on success; otherwise, the error code is returned - /// - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_PosixFAdvise", SetLastError = false /* this is explicitly called out in the man page */)] - internal static extern int PosixFAdvise(SafeFileHandle fd, long offset, long length, FileAdvice advice); - } -} diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.Read.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.Read.cs deleted file mode 100644 index 1be5e78..0000000 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.Read.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Runtime.InteropServices; -using Microsoft.Win32.SafeHandles; - -internal static partial class Interop -{ - internal static partial class Sys - { - /// - /// Reads a number of bytes from an open file descriptor into a specified buffer. - /// - /// The open file descriptor to try to read from - /// The buffer to read info into - /// The size of the buffer - /// - /// Returns the number of bytes read on success; otherwise, -1 is returned - /// Note - on fail. the position of the stream may change depending on the platform; consult man 2 read for more info - /// - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Read", SetLastError = true)] - internal static extern unsafe int Read(SafeFileHandle fd, byte* buffer, int count); - } -} diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.ReadLink.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.ReadLink.cs deleted file mode 100644 index 6397027..0000000 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.ReadLink.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Runtime.InteropServices; -using System.Buffers; -using System.Text; - -internal static partial class Interop -{ - internal static partial class Sys - { - /// - /// Takes a path to a symbolic link and attempts to place the link target path into the buffer. If the buffer is too - /// small, the path will be truncated. No matter what, the buffer will not be null terminated. - /// - /// The path to the symlink - /// The buffer to hold the output path - /// The size of the buffer - /// - /// Returns the number of bytes placed into the buffer on success; bufferSize if the buffer is too small; and -1 on error. - /// - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_ReadLink", SetLastError = true)] - private static extern unsafe int ReadLink(string path, byte[] buffer, int bufferSize); - - /// - /// Takes a path to a symbolic link and returns the link target path. - /// - /// The path to the symlink - /// - /// Returns the link to the target path on success; and null otherwise. - /// - public static string ReadLink(string path) - { - int bufferSize = 256; - do - { - byte[] buffer = ArrayPool.Shared.Rent(bufferSize); - try - { - int resultLength = Interop.Sys.ReadLink(path, buffer, buffer.Length); - if (resultLength < 0) - { - // error - return null; - } - else if (resultLength < buffer.Length) - { - // success - return Encoding.UTF8.GetString(buffer, 0, resultLength); - } - } - finally - { - ArrayPool.Shared.Return(buffer); - } - - // buffer was too small, loop around again and try with a larger buffer. - bufferSize *= 2; - } while (true); - } - } -} diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.Stat.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.Stat.cs deleted file mode 100644 index 0ca199b..0000000 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.Stat.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Runtime.InteropServices; -using Microsoft.Win32.SafeHandles; - -internal static partial class Interop -{ - internal static partial class Sys - { - // Even though csc will by default use a sequential layout, a CS0649 warning as error - // is produced for un-assigned fields when no StructLayout is specified. - // - // Explicitly saying Sequential disables that warning/error for consumers which only - // use Stat in debug builds. - [StructLayout(LayoutKind.Sequential)] - internal struct FileStatus - { - internal FileStatusFlags Flags; - internal int Mode; - internal uint Uid; - internal uint Gid; - internal long Size; - internal long ATime; - internal long ATimeNsec; - internal long MTime; - internal long MTimeNsec; - internal long CTime; - internal long CTimeNsec; - internal long BirthTime; - internal long BirthTimeNsec; - internal long Dev; - internal long Ino; - } - - internal static class FileTypes - { - internal const int S_IFMT = 0xF000; - internal const int S_IFIFO = 0x1000; - internal const int S_IFCHR = 0x2000; - internal const int S_IFDIR = 0x4000; - internal const int S_IFREG = 0x8000; - internal const int S_IFLNK = 0xA000; - internal const int S_IFSOCK = 0xC000; - } - - [Flags] - internal enum FileStatusFlags - { - None = 0, - HasBirthTime = 1, - } - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FStat2", SetLastError = true)] - internal static extern int FStat(SafeFileHandle fd, out FileStatus output); - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Stat2", SetLastError = true)] - internal static extern int Stat(string path, out FileStatus output); - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LStat2", SetLastError = true)] - internal static extern int LStat(string path, out FileStatus output); - } -} diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.SysLog.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.SysLog.cs deleted file mode 100644 index 6b6a74b..0000000 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.SysLog.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Sys - { - internal enum SysLogPriority : int - { - // Priorities - LOG_EMERG = 0, /* system is unusable */ - LOG_ALERT = 1, /* action must be taken immediately */ - LOG_CRIT = 2, /* critical conditions */ - LOG_ERR = 3, /* error conditions */ - LOG_WARNING = 4, /* warning conditions */ - LOG_NOTICE = 5, /* normal but significant condition */ - LOG_INFO = 6, /* informational */ - LOG_DEBUG = 7, /* debug-level messages */ - // Facilities - LOG_KERN = (0<<3), /* kernel messages */ - LOG_USER = (1<<3), /* random user-level messages */ - LOG_MAIL = (2<<3), /* mail system */ - LOG_DAEMON = (3<<3), /* system daemons */ - LOG_AUTH = (4<<3), /* authorization messages */ - LOG_SYSLOG = (5<<3), /* messages generated internally by syslogd */ - LOG_LPR = (6<<3), /* line printer subsystem */ - LOG_NEWS = (7<<3), /* network news subsystem */ - LOG_UUCP = (8<<3), /* UUCP subsystem */ - LOG_CRON = (9<<3), /* clock daemon */ - LOG_AUTHPRIV = (10<<3), /* authorization messages (private) */ - LOG_FTP = (11<<3), /* ftp daemon */ - // Between FTP and Local is reserved for system use - LOG_LOCAL0 = (16<<3), /* reserved for local use */ - LOG_LOCAL1 = (17<<3), /* reserved for local use */ - LOG_LOCAL2 = (18<<3), /* reserved for local use */ - LOG_LOCAL3 = (19<<3), /* reserved for local use */ - LOG_LOCAL4 = (20<<3), /* reserved for local use */ - LOG_LOCAL5 = (21<<3), /* reserved for local use */ - LOG_LOCAL6 = (22<<3), /* reserved for local use */ - LOG_LOCAL7 = (23<<3), /* reserved for local use */ - } - - /// - /// Write a message to the system logger, which in turn writes the message to the system console, log files, etc. - /// See man 3 syslog for more info - /// - /// - /// The OR of a priority and facility in the SysLogPriority enum to declare the priority and facility of the log entry - /// - /// The message to put in the log entry - /// Like printf, the argument is passed to the variadic part of the C++ function to wildcards in the message - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SysLog")] - internal static extern void SysLog(SysLogPriority priority, string message, string arg1); - } -} diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.Unlink.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.Unlink.cs deleted file mode 100644 index 829210f..0000000 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.Unlink.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Sys - { - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Unlink", SetLastError = true)] - internal static extern int Unlink(string pathname); - } -} diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.Write.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.Write.cs deleted file mode 100644 index 0636615..0000000 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.Write.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Runtime.InteropServices; -using Microsoft.Win32.SafeHandles; - -internal static partial class Interop -{ - internal static partial class Sys - { - /// - /// Writes the specified buffer to the provided open file descriptor - /// - /// The file descriptor to try and write to - /// The data to attempt to write - /// The amount of data to write, in bytes - /// - /// Returns the number of bytes written on success; otherwise, returns -1 and sets errno - /// - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Write", SetLastError = true)] - internal static extern unsafe int Write(SafeFileHandle fd, byte* buffer, int bufferSize); - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Write", SetLastError = true)] - internal static extern unsafe int Write(int fd, byte* buffer, int bufferSize); - } -} diff --git a/src/libraries/Common/src/Interop/Windows/Interop.BOOL.cs b/src/libraries/Common/src/Interop/Windows/Interop.BOOL.cs deleted file mode 100644 index 9f4dab8..0000000 --- a/src/libraries/Common/src/Interop/Windows/Interop.BOOL.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -internal partial class Interop -{ - /// - /// Blittable version of Windows BOOL type. It is convenient in situations where - /// manual marshalling is required, or to avoid overhead of regular bool marshalling. - /// - /// - /// Some Windows APIs return arbitrary integer values although the return type is defined - /// as BOOL. It is best to never compare BOOL to TRUE. Always use bResult != BOOL.FALSE - /// or bResult == BOOL.FALSE . - /// - internal enum BOOL : int - { - FALSE = 0, - TRUE = 1, - } -} diff --git a/src/libraries/Common/src/Interop/Windows/kernel32/Interop.CancelIoEx.cs b/src/libraries/Common/src/Interop/Windows/kernel32/Interop.CancelIoEx.cs deleted file mode 100644 index fc99e30..0000000 --- a/src/libraries/Common/src/Interop/Windows/kernel32/Interop.CancelIoEx.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.Win32.SafeHandles; -using System.Runtime.InteropServices; -using System.Threading; - -internal partial class Interop -{ - internal partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern unsafe bool CancelIoEx(SafeHandle handle, NativeOverlapped* lpOverlapped); - } -} diff --git a/src/libraries/Common/src/Interop/Windows/kernel32/Interop.CloseHandle.cs b/src/libraries/Common/src/Interop/Windows/kernel32/Interop.CloseHandle.cs deleted file mode 100644 index 96ed922..0000000 --- a/src/libraries/Common/src/Interop/Windows/kernel32/Interop.CloseHandle.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool CloseHandle(IntPtr handle); - } -} diff --git a/src/libraries/Common/src/Interop/Windows/kernel32/Interop.FileAttributes.cs b/src/libraries/Common/src/Interop/Windows/kernel32/Interop.FileAttributes.cs deleted file mode 100644 index 725a25a..0000000 --- a/src/libraries/Common/src/Interop/Windows/kernel32/Interop.FileAttributes.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -internal partial class Interop -{ - internal partial class Kernel32 - { - internal partial class FileAttributes - { - internal const int FILE_ATTRIBUTE_NORMAL = 0x00000080; - internal const int FILE_ATTRIBUTE_READONLY = 0x00000001; - internal const int FILE_ATTRIBUTE_DIRECTORY = 0x00000010; - internal const int FILE_ATTRIBUTE_REPARSE_POINT = 0x00000400; - } - } -} diff --git a/src/libraries/Common/src/Interop/Windows/kernel32/Interop.FlushFileBuffers.cs b/src/libraries/Common/src/Interop/Windows/kernel32/Interop.FlushFileBuffers.cs deleted file mode 100644 index e10a227..0000000 --- a/src/libraries/Common/src/Interop/Windows/kernel32/Interop.FlushFileBuffers.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.Win32.SafeHandles; -using System; -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool FlushFileBuffers(SafeHandle hHandle); - } -} diff --git a/src/libraries/Common/src/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs b/src/libraries/Common/src/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs deleted file mode 100644 index 076f7f1..0000000 --- a/src/libraries/Common/src/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.Win32.SafeHandles; -using System; -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern unsafe int ReadFile( - SafeHandle handle, - byte* bytes, - int numBytesToRead, - out int numBytesRead, - IntPtr mustBeZero); - } -} diff --git a/src/libraries/Common/src/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs b/src/libraries/Common/src/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs deleted file mode 100644 index 3ae65a8..0000000 --- a/src/libraries/Common/src/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.Win32.SafeHandles; -using System; -using System.Runtime.InteropServices; -using System.Threading; - -internal partial class Interop -{ - internal partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern unsafe int ReadFile( - SafeHandle handle, - byte* bytes, - int numBytesToRead, - IntPtr numBytesRead_mustBeZero, - NativeOverlapped* overlapped); - } -} diff --git a/src/libraries/Common/src/Interop/Windows/kernel32/Interop.SecurityOptions.cs b/src/libraries/Common/src/Interop/Windows/kernel32/Interop.SecurityOptions.cs deleted file mode 100644 index 4a44024..0000000 --- a/src/libraries/Common/src/Interop/Windows/kernel32/Interop.SecurityOptions.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -internal partial class Interop -{ - internal partial class Kernel32 - { - internal partial class SecurityOptions - { - internal const int SECURITY_SQOS_PRESENT = 0x00100000; - internal const int SECURITY_ANONYMOUS = 0 << 16; - internal const int SECURITY_IDENTIFICATION = 1 << 16; - internal const int SECURITY_IMPERSONATION = 2 << 16; - internal const int SECURITY_DELEGATION = 3 << 16; - } - } -} diff --git a/src/libraries/Common/src/Interop/Windows/kernel32/Interop.SetEndOfFile.cs b/src/libraries/Common/src/Interop/Windows/kernel32/Interop.SetEndOfFile.cs deleted file mode 100644 index e5d6004..0000000 --- a/src/libraries/Common/src/Interop/Windows/kernel32/Interop.SetEndOfFile.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.Win32.SafeHandles; -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern bool SetEndOfFile(SafeFileHandle hFile); - } -} diff --git a/src/libraries/Common/src/Interop/Windows/kernel32/Interop.SetFilePointerEx.cs b/src/libraries/Common/src/Interop/Windows/kernel32/Interop.SetFilePointerEx.cs deleted file mode 100644 index c0e5247..0000000 --- a/src/libraries/Common/src/Interop/Windows/kernel32/Interop.SetFilePointerEx.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.Win32.SafeHandles; -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern bool SetFilePointerEx(SafeFileHandle hFile, long liDistanceToMove, out long lpNewFilePointer, uint dwMoveMethod); - } -} diff --git a/src/libraries/Common/src/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs b/src/libraries/Common/src/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs deleted file mode 100644 index e7e868e..0000000 --- a/src/libraries/Common/src/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.Win32.SafeHandles; -using System; -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class Kernel32 - { - // Note there are two different WriteFile prototypes - this is to use - // the type system to force you to not trip across a "feature" in - // Win32's async IO support. You can't do the following three things - // simultaneously: overlapped IO, free the memory for the overlapped - // struct in a callback (or an EndWrite method called by that callback), - // and pass in an address for the numBytesRead parameter. - - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern unsafe int WriteFile(SafeHandle handle, byte* bytes, int numBytesToWrite, out int numBytesWritten, IntPtr mustBeZero); - - } -} diff --git a/src/libraries/Common/src/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs b/src/libraries/Common/src/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs deleted file mode 100644 index dc1e975..0000000 --- a/src/libraries/Common/src/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.Win32.SafeHandles; -using System; -using System.Runtime.InteropServices; -using System.Threading; -internal partial class Interop -{ - internal partial class Kernel32 - { - // Note there are two different WriteFile prototypes - this is to use - // the type system to force you to not trip across a "feature" in - // Win32's async IO support. You can't do the following three things - // simultaneously: overlapped IO, free the memory for the overlapped - // struct in a callback (or an EndWrite method called by that callback), - // and pass in an address for the numBytesRead parameter. - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern unsafe int WriteFile(SafeHandle handle, byte* bytes, int numBytesToWrite, IntPtr numBytesWritten_mustBeZero, NativeOverlapped* lpOverlapped); - } -} diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeDirectoryHandle.Unix.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeDirectoryHandle.Unix.cs deleted file mode 100644 index f7435ea..0000000 --- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeDirectoryHandle.Unix.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Runtime.InteropServices; - -namespace Microsoft.Win32.SafeHandles -{ - internal sealed class SafeDirectoryHandle : SafeHandle - { - private SafeDirectoryHandle() : base(IntPtr.Zero, true) - { - } - - protected override bool ReleaseHandle() - { - return Interop.Sys.CloseDir(handle) == 0; - } - - public override bool IsInvalid - { - get { return handle == IntPtr.Zero; } - } - } -} diff --git a/src/libraries/Common/src/System/IO/StreamHelpers.CopyValidation.cs b/src/libraries/Common/src/System/IO/StreamHelpers.CopyValidation.cs deleted file mode 100644 index 45bbd81..0000000 --- a/src/libraries/Common/src/System/IO/StreamHelpers.CopyValidation.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.IO -{ - /// Provides methods to help in the implementation of Stream-derived types. - internal static partial class StreamHelpers - { - /// Validate the arguments to CopyTo, as would Stream.CopyTo. - public static void ValidateCopyToArgs(Stream source, Stream destination, int bufferSize) - { - if (destination == null) - { - throw new ArgumentNullException(nameof(destination)); - } - - if (bufferSize <= 0) - { - throw new ArgumentOutOfRangeException(nameof(bufferSize), bufferSize, SR.ArgumentOutOfRange_NeedPosNum); - } - - bool sourceCanRead = source.CanRead; - if (!sourceCanRead && !source.CanWrite) - { - throw new ObjectDisposedException(null, SR.ObjectDisposed_StreamClosed); - } - - bool destinationCanWrite = destination.CanWrite; - if (!destinationCanWrite && !destination.CanRead) - { - throw new ObjectDisposedException(nameof(destination), SR.ObjectDisposed_StreamClosed); - } - - if (!sourceCanRead) - { - throw new NotSupportedException(SR.NotSupported_UnreadableStream); - } - - if (!destinationCanWrite) - { - throw new NotSupportedException(SR.NotSupported_UnwritableStream); - } - } - } -} diff --git a/src/libraries/Common/src/System/Threading/Tasks/TaskToApm.cs b/src/libraries/Common/src/System/Threading/Tasks/TaskToApm.cs deleted file mode 100644 index add41f5..0000000 --- a/src/libraries/Common/src/System/Threading/Tasks/TaskToApm.cs +++ /dev/null @@ -1,189 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -// Helper methods for using Tasks to implement the APM pattern. -// -// Example usage, wrapping a Task-returning FooAsync method with Begin/EndFoo methods: -// -// public IAsyncResult BeginFoo(..., AsyncCallback callback, object state) -// { -// Task t = FooAsync(...); -// return TaskToApm.Begin(t, callback, state); -// } -// public int EndFoo(IAsyncResult asyncResult) -// { -// return TaskToApm.End(asyncResult); -// } - -using System.Diagnostics; - -namespace System.Threading.Tasks -{ - /// - /// Provides support for efficiently using Tasks to implement the APM (Begin/End) pattern. - /// - internal static class TaskToApm - { - /// - /// Marshals the Task as an IAsyncResult, using the supplied callback and state - /// to implement the APM pattern. - /// - /// The Task to be marshaled. - /// The callback to be invoked upon completion. - /// The state to be stored in the IAsyncResult. - /// An IAsyncResult to represent the task's asynchronous operation. - public static IAsyncResult Begin(Task task, AsyncCallback callback, object state) - { - Debug.Assert(task != null); - - // If the task has already completed, then since the Task's CompletedSynchronously==false - // and we want it to be true, we need to create a new IAsyncResult. (We also need the AsyncState to match.) - IAsyncResult asyncResult; - if (task.IsCompleted) - { - // Synchronous completion. - asyncResult = new TaskWrapperAsyncResult(task, state, completedSynchronously: true); - callback?.Invoke(asyncResult); - } - else - { - // For asynchronous completion we need to schedule a callback. Whether we can use the Task as the IAsyncResult - // depends on whether the Task's AsyncState has reference equality with the requested state. - asyncResult = task.AsyncState == state ? (IAsyncResult)task : new TaskWrapperAsyncResult(task, state, completedSynchronously: false); - if (callback != null) - { - InvokeCallbackWhenTaskCompletes(task, callback, asyncResult); - } - } - return asyncResult; - } - - /// Processes an IAsyncResult returned by Begin. - /// The IAsyncResult to unwrap. - public static void End(IAsyncResult asyncResult) - { - Task task; - - // If the IAsyncResult is our task-wrapping IAsyncResult, extract the Task. - var twar = asyncResult as TaskWrapperAsyncResult; - if (twar != null) - { - task = twar.Task; - Debug.Assert(task != null, "TaskWrapperAsyncResult should never wrap a null Task."); - } - else - { - // Otherwise, the IAsyncResult should be a Task. - task = asyncResult as Task; - } - - // Make sure we actually got a task, then complete the operation by waiting on it. - if (task == null) - { - throw new ArgumentNullException(); - } - - task.GetAwaiter().GetResult(); - } - - /// Processes an IAsyncResult returned by Begin. - /// The IAsyncResult to unwrap. - public static TResult End(IAsyncResult asyncResult) - { - Task task; - - // If the IAsyncResult is our task-wrapping IAsyncResult, extract the Task. - var twar = asyncResult as TaskWrapperAsyncResult; - if (twar != null) - { - task = twar.Task as Task; - Debug.Assert(twar.Task != null, "TaskWrapperAsyncResult should never wrap a null Task."); - } - else - { - // Otherwise, the IAsyncResult should be a Task. - task = asyncResult as Task; - } - - // Make sure we actually got a task, then complete the operation by waiting on it. - if (task == null) - { - throw new ArgumentNullException(); - } - - return task.GetAwaiter().GetResult(); - } - - /// Invokes the callback asynchronously when the task has completed. - /// The Task to await. - /// The callback to invoke when the Task completes. - /// The Task used as the IAsyncResult. - private static void InvokeCallbackWhenTaskCompletes(Task antecedent, AsyncCallback callback, IAsyncResult asyncResult) - { - Debug.Assert(antecedent != null); - Debug.Assert(callback != null); - Debug.Assert(asyncResult != null); - - // We use OnCompleted rather than ContinueWith in order to avoid running synchronously - // if the task has already completed by the time we get here. This is separated out into - // its own method currently so that we only pay for the closure if necessary. - antecedent.ConfigureAwait(continueOnCapturedContext: false) - .GetAwaiter() - .OnCompleted(() => callback(asyncResult)); - - // PERFORMANCE NOTE: - // Assuming we're in the default ExecutionContext, the "slow path" of an incomplete - // task will result in four allocations: the new IAsyncResult, the delegate+closure - // in this method, and the continuation object inside of OnCompleted (necessary - // to capture both the Action delegate and the ExecutionContext in a single object). - // In the future, if performance requirements drove a need, those four - // allocations could be reduced to one. This would be achieved by having TaskWrapperAsyncResult - // also implement ITaskCompletionAction (and optionally IThreadPoolWorkItem). It would need - // additional fields to store the AsyncCallback and an ExecutionContext. Once configured, - // it would be set into the Task as a continuation. Its Invoke method would then be run when - // the antecedent completed, and, doing all of the necessary work to flow ExecutionContext, - // it would invoke the AsyncCallback. It could also have a field on it for the antecedent, - // so that the End method would have access to the completed antecedent. For related examples, - // see other implementations of ITaskCompletionAction, and in particular ReadWriteTask - // used in Stream.Begin/EndXx's implementation. - } - - /// - /// Provides a simple IAsyncResult that wraps a Task. This, in effect, allows - /// for overriding what's seen for the CompletedSynchronously and AsyncState values. - /// - private sealed class TaskWrapperAsyncResult : IAsyncResult - { - /// The wrapped Task. - internal readonly Task Task; - /// The new AsyncState value. - private readonly object _state; - /// The new CompletedSynchronously value. - private readonly bool _completedSynchronously; - - /// Initializes the IAsyncResult with the Task to wrap and the overriding AsyncState and CompletedSynchronously values. - /// The Task to wrap. - /// The new AsyncState value - /// The new CompletedSynchronously value. - internal TaskWrapperAsyncResult(Task task, object state, bool completedSynchronously) - { - Debug.Assert(task != null); - Debug.Assert(!completedSynchronously || task.IsCompleted, "If completedSynchronously is true, the task must be completed."); - - this.Task = task; - _state = state; - _completedSynchronously = completedSynchronously; - } - - // The IAsyncResult implementation. - // - IsCompleted and AsyncWaitHandle just pass through to the Task. - // - AsyncState and CompletedSynchronously return the corresponding values stored in this object. - - object IAsyncResult.AsyncState { get { return _state; } } - bool IAsyncResult.CompletedSynchronously { get { return _completedSynchronously; } } - bool IAsyncResult.IsCompleted { get { return this.Task.IsCompleted; } } - WaitHandle IAsyncResult.AsyncWaitHandle { get { return ((IAsyncResult)this.Task).AsyncWaitHandle; } } - } - } -} diff --git a/src/libraries/Common/tests/Common.Tests.csproj b/src/libraries/Common/tests/Common.Tests.csproj index f643221..a73d2a8 100644 --- a/src/libraries/Common/tests/Common.Tests.csproj +++ b/src/libraries/Common/tests/Common.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -93,8 +93,8 @@ - - ProductionCode\Common\System\Threading\Tasks\TaskToApm.cs + + ProductionCode\Common\CoreLib\System\Threading\Tasks\TaskToApm.cs Common\CoreLib\System\IO\PathInternal.cs @@ -130,7 +130,7 @@ Common\CoreLib\System\IO\PathInternal.Unix.cs - + Common\Interop\Unix\Interop.PathConf.cs diff --git a/src/libraries/CoreFx.Private.TestUtilities/src/CoreFx.Private.TestUtilities.csproj b/src/libraries/CoreFx.Private.TestUtilities/src/CoreFx.Private.TestUtilities.csproj index 0190622..3b42151 100644 --- a/src/libraries/CoreFx.Private.TestUtilities/src/CoreFx.Private.TestUtilities.csproj +++ b/src/libraries/CoreFx.Private.TestUtilities/src/CoreFx.Private.TestUtilities.csproj @@ -1,4 +1,4 @@ - + @@ -88,8 +88,8 @@ Common\Interop\Windows\Interop.Libraries.cs - - Common\Interop\Windows\kernel32\Interop.CloseHandle.cs + + Common\CoreLib\Interop\Windows\Kernel32\Interop.CloseHandle.cs Common\Interop\Windows\advapi32\Interop.TOKEN_INFORMATION_CLASS.cs @@ -100,8 +100,8 @@ Common\Interop\Windows\advapi32\Interop.TOKEN_ELEVATION.cs - - Common\Interop\Windows\Interop.BOOL.cs + + Common\CoreLib\Interop\Windows\Interop.BOOL.cs diff --git a/src/libraries/Microsoft.Win32.Registry/src/Microsoft.Win32.Registry.csproj b/src/libraries/Microsoft.Win32.Registry/src/Microsoft.Win32.Registry.csproj index a377e21..5e83971 100644 --- a/src/libraries/Microsoft.Win32.Registry/src/Microsoft.Win32.Registry.csproj +++ b/src/libraries/Microsoft.Win32.Registry/src/Microsoft.Win32.Registry.csproj @@ -1,4 +1,4 @@ - + @@ -90,8 +90,8 @@ Common\Interop\Windows\Interop.RegSetValueEx.cs - - Common\Interop\Windows\Interop.BOOL.cs + + Common\CoreLib\Interop\Windows\Interop.BOOL.cs Common\Interop\Windows\Interop.SECURITY_ATTRIBUTES.cs diff --git a/src/libraries/System.Collections/src/System.Collections.csproj b/src/libraries/System.Collections/src/System.Collections.csproj index 9560d47..7f4e817 100644 --- a/src/libraries/System.Collections/src/System.Collections.csproj +++ b/src/libraries/System.Collections/src/System.Collections.csproj @@ -23,9 +23,13 @@ - - - + + + Common\System\Collections\Generic\ICollectionDebugView.cs + + + Common\System\Collections\Generic\IDictionaryDebugView.cs + diff --git a/src/libraries/System.Collections/src/System/Collections/Generic/ICollectionDebugView.cs b/src/libraries/System.Collections/src/System/Collections/Generic/ICollectionDebugView.cs deleted file mode 100644 index 9916e85..0000000 --- a/src/libraries/System.Collections/src/System/Collections/Generic/ICollectionDebugView.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; - -namespace System.Collections.Generic -{ - internal sealed class ICollectionDebugView - { - private readonly ICollection _collection; - - public ICollectionDebugView(ICollection collection) - { - if (collection == null) - { - throw new ArgumentNullException(nameof(collection)); - } - - _collection = collection; - } - - [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] - public T[] Items - { - get - { - T[] items = new T[_collection.Count]; - _collection.CopyTo(items, 0); - return items; - } - } - } -} diff --git a/src/libraries/System.Collections/src/System/Collections/Generic/IDictionaryDebugView.cs b/src/libraries/System.Collections/src/System/Collections/Generic/IDictionaryDebugView.cs deleted file mode 100644 index 4721642..0000000 --- a/src/libraries/System.Collections/src/System/Collections/Generic/IDictionaryDebugView.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; - -namespace System.Collections.Generic -{ - internal sealed class IDictionaryDebugView - { - private readonly IDictionary _dict; - - public IDictionaryDebugView(IDictionary dictionary) - { - if (dictionary == null) - throw new ArgumentNullException(nameof(dictionary)); - - _dict = dictionary; - } - - [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] - public KeyValuePair[] Items - { - get - { - KeyValuePair[] items = new KeyValuePair[_dict.Count]; - _dict.CopyTo(items, 0); - return items; - } - } - } - - internal sealed class DictionaryKeyCollectionDebugView - { - private readonly ICollection _collection; - - public DictionaryKeyCollectionDebugView(ICollection collection) - { - if (collection == null) - throw new ArgumentNullException(nameof(collection)); - - _collection = collection; - } - - [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] - public TKey[] Items - { - get - { - TKey[] items = new TKey[_collection.Count]; - _collection.CopyTo(items, 0); - return items; - } - } - } - - internal sealed class DictionaryValueCollectionDebugView - { - private readonly ICollection _collection; - - public DictionaryValueCollectionDebugView(ICollection collection) - { - if (collection == null) - throw new ArgumentNullException(nameof(collection)); - - _collection = collection; - } - - [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] - public TValue[] Items - { - get - { - TValue[] items = new TValue[_collection.Count]; - _collection.CopyTo(items, 0); - return items; - } - } - } -} diff --git a/src/libraries/System.Console/src/System.Console.csproj b/src/libraries/System.Console/src/System.Console.csproj index fbff230..78c2522 100644 --- a/src/libraries/System.Console/src/System.Console.csproj +++ b/src/libraries/System.Console/src/System.Console.csproj @@ -1,4 +1,4 @@ - + @@ -53,8 +53,8 @@ Common\Interop\Windows\Interop.Libraries.cs - - Common\Interop\Windows\Interop.BOOL.cs + + Common\CoreLib\Interop\Windows\Interop.BOOL.cs Common\Interop\Windows\Interop.Beep.cs @@ -201,10 +201,10 @@ Common\Interop\Unix\Interop.Errors.cs - - Common\Interop\Unix\Interop.IOErrors.cs + + Common\CoreLib\Interop\Unix\Interop.IOErrors.cs - + Common\Interop\Unix\Interop.Close.cs @@ -213,7 +213,7 @@ Common\Interop\Unix\Interop.FileDescriptors.cs - + Common\Interop\Unix\Interop.FLock.cs @@ -222,13 +222,13 @@ Common\Interop\Unix\Interop.IsATty.cs - + Common\Interop\Unix\Interop.LSeek.cs - + Common\Interop\Unix\Interop.Open.cs - + Common\Interop\Unix\Interop.OpenFlags.cs @@ -249,13 +249,13 @@ Common\Interop\Unix\Interop.SNPrintF.cs - + Common\Interop\Unix\Interop.Stat.cs - + Common\Interop\Unix\Interop.Read.cs - + Common\Interop\Unix\Interop.Write.cs diff --git a/src/libraries/System.Data.SqlClient/src/System.Data.SqlClient.csproj b/src/libraries/System.Data.SqlClient/src/System.Data.SqlClient.csproj index 22d3bc9..9a8435f 100644 --- a/src/libraries/System.Data.SqlClient/src/System.Data.SqlClient.csproj +++ b/src/libraries/System.Data.SqlClient/src/System.Data.SqlClient.csproj @@ -1,4 +1,4 @@ - + @@ -208,8 +208,8 @@ System\Data\SQLTypes\SQLResource.cs - - Common\System\Threading\Tasks\TaskToApm.cs + + Common\CoreLib\System\Threading\Tasks\TaskToApm.cs @@ -301,8 +301,8 @@ Common\System\Net\Security\NetEventSource.Security.cs - - Common\Interop\Windows\kernel32\Interop.CloseHandle.cs + + Common\CoreLib\Interop\Windows\Kernel32\Interop.CloseHandle.cs Common\Interop\Windows\sspicli\GlobalSSPI.cs diff --git a/src/libraries/System.Diagnostics.EventLog/src/System.Diagnostics.EventLog.csproj b/src/libraries/System.Diagnostics.EventLog/src/System.Diagnostics.EventLog.csproj index 7c4f3df..462be81 100644 --- a/src/libraries/System.Diagnostics.EventLog/src/System.Diagnostics.EventLog.csproj +++ b/src/libraries/System.Diagnostics.EventLog/src/System.Diagnostics.EventLog.csproj @@ -1,4 +1,4 @@ - + @@ -41,8 +41,8 @@ Common\Interop\Windows\Interop.Libraries.cs - - Common\Interop\Windows\kernel32\Interop.CloseHandle.cs + + Common\CoreLib\Interop\Windows\Kernel32\Interop.CloseHandle.cs Common\Interop\Windows\kernel32\Interop.FormatMessage_SafeLibraryHandle.cs diff --git a/src/libraries/System.Diagnostics.FileVersionInfo/src/System.Diagnostics.FileVersionInfo.csproj b/src/libraries/System.Diagnostics.FileVersionInfo/src/System.Diagnostics.FileVersionInfo.csproj index 8d94dbf..31c0aa8 100644 --- a/src/libraries/System.Diagnostics.FileVersionInfo/src/System.Diagnostics.FileVersionInfo.csproj +++ b/src/libraries/System.Diagnostics.FileVersionInfo/src/System.Diagnostics.FileVersionInfo.csproj @@ -1,4 +1,4 @@ - + @@ -50,7 +50,7 @@ Common\Interop\Unix\Interop.Errors.cs - + Common\Interop\Unix\Interop.Stat.cs diff --git a/src/libraries/System.Diagnostics.PerformanceCounter/src/System.Diagnostics.PerformanceCounter.csproj b/src/libraries/System.Diagnostics.PerformanceCounter/src/System.Diagnostics.PerformanceCounter.csproj index 138d77a..8d43f2a 100644 --- a/src/libraries/System.Diagnostics.PerformanceCounter/src/System.Diagnostics.PerformanceCounter.csproj +++ b/src/libraries/System.Diagnostics.PerformanceCounter/src/System.Diagnostics.PerformanceCounter.csproj @@ -1,4 +1,4 @@ - + @@ -45,8 +45,8 @@ - - Common\Interop\Windows\Interop.BOOL.cs + + Common\CoreLib\Interop\Windows\Interop.BOOL.cs Common\Interop\Windows\Interop.Errors.cs diff --git a/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj b/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj index c8de234..5bc15f8 100644 --- a/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj +++ b/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj @@ -1,4 +1,4 @@ - + @@ -93,8 +93,8 @@ Common\Interop\Windows\Interop.Libraries.cs - - Common\Interop\Windows\kernel32\Interop.CloseHandle.cs + + Common\CoreLib\Interop\Windows\Kernel32\Interop.CloseHandle.cs Common\Interop\Windows\advapi32\Interop.PERF_INFO.cs @@ -219,8 +219,8 @@ Common\Interop\Windows\advapi32\Interop.CreateProcessWithLogon.cs - - Common\Interop\Windows\Interop.BOOL.cs + + Common\CoreLib\Interop\Windows\Interop.BOOL.cs Common\Interop\Windows\kernel32\Interop.SECURITY_ATTRIBUTES.cs @@ -303,7 +303,7 @@ Common\Interop\Unix\Interop.Errors.cs - + Common\Interop\Unix\Interop.Close.cs @@ -333,7 +333,7 @@ Common\Interop\Unix\Interop.Kill.cs - + Common\Interop\Unix\Interop.ReadLink.cs @@ -342,7 +342,7 @@ Common\Interop\Unix\Interop.ResourceLimits.cs - + Common\Interop\Unix\Interop.PathConf.cs @@ -413,7 +413,7 @@ Common\Unix\System.Native\Interop.GetTimestamp.cs - + Common\Unix\System.Native\Interop.Stat.cs diff --git a/src/libraries/System.IO.Compression.Brotli/src/System.IO.Compression.Brotli.csproj b/src/libraries/System.IO.Compression.Brotli/src/System.IO.Compression.Brotli.csproj index 2555fb0..8a26bb4 100644 --- a/src/libraries/System.IO.Compression.Brotli/src/System.IO.Compression.Brotli.csproj +++ b/src/libraries/System.IO.Compression.Brotli/src/System.IO.Compression.Brotli.csproj @@ -1,4 +1,4 @@ - + @@ -24,8 +24,8 @@ - - Common\System\Threading\Tasks\TaskToApm.cs + + Common\CoreLib\System\Threading\Tasks\TaskToApm.cs Common\Microsoft\Win32\SafeHandles\SafeBrotliHandle.cs diff --git a/src/libraries/System.IO.Compression.Brotli/tests/System.IO.Compression.Brotli.Tests.csproj b/src/libraries/System.IO.Compression.Brotli/tests/System.IO.Compression.Brotli.Tests.csproj index 087a5bc..dcad1ae 100644 --- a/src/libraries/System.IO.Compression.Brotli/tests/System.IO.Compression.Brotli.Tests.csproj +++ b/src/libraries/System.IO.Compression.Brotli/tests/System.IO.Compression.Brotli.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -28,8 +28,8 @@ Common\System\IO\TempFile.cs - - Common\System\Threading\Tasks\TaskToApm.cs + + Common\CoreLib\System\Threading\Tasks\TaskToApm.cs diff --git a/src/libraries/System.IO.Compression/src/System.IO.Compression.csproj b/src/libraries/System.IO.Compression/src/System.IO.Compression.csproj index ea2cc95..1d5ecf9 100644 --- a/src/libraries/System.IO.Compression/src/System.IO.Compression.csproj +++ b/src/libraries/System.IO.Compression/src/System.IO.Compression.csproj @@ -1,4 +1,4 @@ - + @@ -41,8 +41,8 @@ - - Common\System\Threading\Tasks\TaskToApm.cs + + Common\CoreLib\System\Threading\Tasks\TaskToApm.cs @@ -58,8 +58,8 @@ - - Common\System\IO\StreamHelpers.CopyValidation.cs + + Common\CoreLib\System\IO\StreamHelpers.CopyValidation.cs @@ -90,8 +90,8 @@ Common\System\IO\PathInternal.Unix.cs - - Common\Interop\Unix\System.Native\Interop.PathConf.cs + + Common\CoreLib\Interop\Unix\System.Native\Interop.PathConf.cs diff --git a/src/libraries/System.IO.Compression/tests/System.IO.Compression.Tests.csproj b/src/libraries/System.IO.Compression/tests/System.IO.Compression.Tests.csproj index f04dd27..4512a3f 100644 --- a/src/libraries/System.IO.Compression/tests/System.IO.Compression.Tests.csproj +++ b/src/libraries/System.IO.Compression/tests/System.IO.Compression.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -54,8 +54,8 @@ Common\System\IO\Compression\ZipTestHelper.cs - - Common\System\Threading\Tasks\TaskToApm.cs + + Common\CoreLib\System\Threading\Tasks\TaskToApm.cs diff --git a/src/libraries/System.IO.FileSystem.DriveInfo/src/System.IO.FileSystem.DriveInfo.csproj b/src/libraries/System.IO.FileSystem.DriveInfo/src/System.IO.FileSystem.DriveInfo.csproj index a928d8f..782a98c 100644 --- a/src/libraries/System.IO.FileSystem.DriveInfo/src/System.IO.FileSystem.DriveInfo.csproj +++ b/src/libraries/System.IO.FileSystem.DriveInfo/src/System.IO.FileSystem.DriveInfo.csproj @@ -1,4 +1,4 @@ - + @@ -48,7 +48,7 @@ Common\Interop\Windows\Interop.SetThreadErrorMode.cs - + Common\Interop\Windows\Interop.SecurityOptions.cs @@ -78,13 +78,13 @@ Common\Interop\Unix\Interop.Errors.cs - - Common\Interop\Unix\Interop.IOErrors.cs + + Common\CoreLib\Interop\Unix\Interop.IOErrors.cs Common\System\IO\PathInternal.Unix.cs - + Common\Interop\Unix\Interop.PathConf.cs diff --git a/src/libraries/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj b/src/libraries/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj index c797318..405b854 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj +++ b/src/libraries/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj @@ -1,4 +1,4 @@ - + @@ -39,8 +39,8 @@ Common\Interop\Windows\Interop.Libraries.cs - - Common\Interop\Windows\Interop.BOOL.cs + + Common\CoreLib\Interop\Windows\Interop.BOOL.cs Common\Interop\Windows\Interop.SECURITY_ATTRIBUTES.cs @@ -54,7 +54,7 @@ Component - + Common\Interop\Windows\Interop.CloseHandle.cs @@ -80,19 +80,19 @@ Common\Interop\Unix\Interop.Libraries.cs - + Common\Interop\Unix\libc\Interop.Read.cs Common\Interop\Unix\Interop.Errors.cs - - Common\Interop\Unix\Interop.IOErrors.cs + + Common\CoreLib\Interop\Unix\Interop.IOErrors.cs Common\System\IO\PathInternal.Unix.cs - + Common\Interop\Unix\Interop.PathConf.cs @@ -104,7 +104,7 @@ Common\Interop\Unix\Interop.Poll.cs - + Common\Interop\Unix\Interop.Stat.cs diff --git a/src/libraries/System.IO.FileSystem/src/System.IO.FileSystem.csproj b/src/libraries/System.IO.FileSystem/src/System.IO.FileSystem.csproj index 35b1396..4175a2f 100644 --- a/src/libraries/System.IO.FileSystem/src/System.IO.FileSystem.csproj +++ b/src/libraries/System.IO.FileSystem/src/System.IO.FileSystem.csproj @@ -1,4 +1,4 @@ - + @@ -42,8 +42,8 @@ Common\System\IO\PathInternal.CaseSensitivity.cs - - Common\System\IO\StreamHelpers.CopyValidation.cs + + Common\CoreLib\System\IO\StreamHelpers.CopyValidation.cs Common\CoreLib\System\IO\PathInternal.cs @@ -52,7 +52,9 @@ - + + Common\System\IO\DisableMediaInsertionPrompt.cs + @@ -60,7 +62,7 @@ Common\Interop\Windows\Interop.Libraries.cs - + Common\Interop\Windows\Interop.CloseHandle.cs @@ -81,8 +83,8 @@ Common\CoreLib\System\IO\Win32Marshal.cs - - Common\Interop\Windows\Interop.BOOL.cs + + Common\CoreLib\Interop\Windows\Interop.BOOL.cs Common\Interop\Windows\Interop.SECURITY_ATTRIBUTES.cs @@ -99,7 +101,7 @@ Common\Interop\Windows\Interop.FileOperations.cs - + Common\Interop\Windows\Interop.FileAttributes.cs @@ -241,8 +243,8 @@ Common\Interop\Unix\Interop.Errors.cs - - Common\Interop\Unix\Interop.IOErrors.cs + + Common\CoreLib\Interop\Unix\Interop.IOErrors.cs Common\Interop\Unix\Interop.ChMod.cs @@ -253,10 +255,10 @@ Common\Interop\Unix\Interop.MkDir.cs - + Common\Interop\Unix\Interop.Permissions.cs - + Common\Interop\Unix\Interop.Unlink.cs @@ -265,7 +267,7 @@ Common\Interop\Unix\Interop.GetEUid.cs - + Common\Interop\Unix\Interop.Stat.cs @@ -280,7 +282,7 @@ Common\Interop\Unix\Interop.MountPoints.cs - + Common\Interop\Unix\Interop.Read.cs @@ -322,4 +324,4 @@ - \ No newline at end of file + diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/DisableMediaInsertionPrompt.cs b/src/libraries/System.IO.FileSystem/src/System/IO/DisableMediaInsertionPrompt.cs deleted file mode 100644 index aa10e8d..0000000 --- a/src/libraries/System.IO.FileSystem/src/System/IO/DisableMediaInsertionPrompt.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.IO -{ - /// - /// Simple wrapper to safely disable the normal media insertion prompt for - /// removable media (floppies, cds, memory cards, etc.) - /// - /// - /// Note that removable media file systems lazily load. After starting the OS - /// they won't be loaded until you have media in the drive- and as such the - /// prompt won't happen. You have to have had media in at least once to get - /// the file system to load and then have removed it. - /// - internal struct DisableMediaInsertionPrompt : IDisposable - { - private bool _disableSuccess; - private uint _oldMode; - - public static DisableMediaInsertionPrompt Create() - { - DisableMediaInsertionPrompt prompt = new DisableMediaInsertionPrompt(); - prompt._disableSuccess = Interop.Kernel32.SetThreadErrorMode(Interop.Kernel32.SEM_FAILCRITICALERRORS, out prompt._oldMode); - return prompt; - } - - public void Dispose() - { - uint ignore; - if (_disableSuccess) - Interop.Kernel32.SetThreadErrorMode(_oldMode, out ignore); - } - } -} diff --git a/src/libraries/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj b/src/libraries/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj index ffa00de..21b5020 100644 --- a/src/libraries/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj +++ b/src/libraries/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj @@ -1,4 +1,4 @@ - + @@ -63,7 +63,7 @@ Common\Interop\Windows\Interop.Libraries.cs - + Common\Interop\Windows\Interop.CloseHandle.cs @@ -72,7 +72,7 @@ Common\Interop\Windows\Interop.FormatMessage.cs - + Common\Interop\Windows\Interop.FileAttributes.cs @@ -105,10 +105,10 @@ Common\Interop\Windows\Interop.PipeOptions.cs - - Common\Interop\Windows\Interop.BOOL.cs + + Common\CoreLib\Interop\Windows\Interop.BOOL.cs - + Common\Interop\Windows\Interop.SecurityOptions.cs @@ -135,8 +135,8 @@ Common\Interop\Unix\Interop.Fcntl.SetCloseOnExec.cs - - Common\Interop\Unix\Interop.IOErrors.cs + + Common\CoreLib\Interop\Unix\Interop.IOErrors.cs Common\Interop\Unix\Interop.MMap.cs @@ -147,13 +147,13 @@ Common\Interop\Unix\Interop.MSync.cs - + Common\Interop\Unix\Interop.Open.cs - + Common\Interop\Unix\Interop.OpenFlags.cs - + Common\Interop\Unix\Interop.Permissions.cs @@ -163,7 +163,7 @@ - + Common\Interop\Unix\Interop.FTruncate.cs @@ -172,7 +172,7 @@ Common\Interop\Unix\Interop.ShmOpen.cs - + Common\Interop\Unix\Interop.Unlink.cs diff --git a/src/libraries/System.IO.Pipes/src/System.IO.Pipes.csproj b/src/libraries/System.IO.Pipes/src/System.IO.Pipes.csproj index ed271aa..0234e1a 100644 --- a/src/libraries/System.IO.Pipes/src/System.IO.Pipes.csproj +++ b/src/libraries/System.IO.Pipes/src/System.IO.Pipes.csproj @@ -1,4 +1,4 @@ - + @@ -28,18 +28,18 @@ - - Common\System\IO\StreamHelpers.CopyValidation.cs + + Common\CoreLib\System\IO\StreamHelpers.CopyValidation.cs - - Common\System\Threading\Tasks\TaskToApm.cs + + Common\CoreLib\System\Threading\Tasks\TaskToApm.cs Common\Interop\Windows\Interop.Libraries.cs - + Common\Interop\Windows\Interop.CloseHandle.cs @@ -48,11 +48,11 @@ Common\Interop\Windows\Interop.FormatMessage.cs - + Common\Interop\Windows\Interop.SecurityOptions.cs - - Common\Interop\Windows\Interop.BOOL.cs + + Common\CoreLib\Interop\Windows\Interop.BOOL.cs Common\Interop\Windows\Interop.SECURITY_ATTRIBUTES.cs @@ -99,22 +99,22 @@ Common\Interop\Windows\Interop.SetNamedPipeHandleState.cs - + Common\Interop\Windows\Interop.CancelIoEx.cs - + Common\Interop\Windows\Interop.FlushFileBuffers.cs - + Common\Interop\Windows\Interop.ReadFile_IntPtr.cs - + Common\Interop\Windows\Interop.ReadFile_NativeOverlapped.cs - + Common\Interop\Windows\Interop.WriteFile_IntPtr.cs - + Common\Interop\Windows\Interop.WriteFile_NativeOverlapped.cs @@ -179,10 +179,10 @@ Common\Interop\Unix\Interop.Errors.cs - - Common\Interop\Unix\Interop.IOErrors.cs + + Common\CoreLib\Interop\Unix\Interop.IOErrors.cs - + Common\Interop\Unix\Interop.Close.cs @@ -191,7 +191,7 @@ Common\Interop\Unix\Interop.Fcntl.SetCloseOnExec.cs - + Common\Interop\Unix\Interop.FLock.cs @@ -203,10 +203,10 @@ Common\Interop\Unix\Interop.MkDir.cs - + Common\Interop\Unix\Interop.Open.cs - + Common\Interop\Unix\Interop.OpenFlags.cs @@ -221,13 +221,13 @@ Common\Interop\Unix\Interop.Read.Pipe.cs - + Common\Interop\Unix\Interop.Unlink.cs Common\Interop\Unix\Interop.Write.Pipe.cs - + Common\Interop\Unix\Interop.Stat.cs diff --git a/src/libraries/System.IO.Ports/src/System.IO.Ports.csproj b/src/libraries/System.IO.Ports/src/System.IO.Ports.csproj index 1a710ac..52295d6 100644 --- a/src/libraries/System.IO.Ports/src/System.IO.Ports.csproj +++ b/src/libraries/System.IO.Ports/src/System.IO.Ports.csproj @@ -1,4 +1,4 @@ - + @@ -86,23 +86,23 @@ Common\Interop\Windows\kernel32\Interop.WaitCommEvent.cs - - Common\Interop\Windows\kernel32\Interop.ReadFile_SafeHandle_IntPtr.cs + + Common\CoreLib\Interop\Windows\Kernel32\Interop.ReadFile_SafeHandle_IntPtr.cs - - Common\Interop\Windows\kernel32\Interop.ReadFile_SafeHandle_NativeOverlapped.cs + + Common\CoreLib\Interop\Windows\Kernel32\Interop.ReadFile_SafeHandle_NativeOverlapped.cs - - Common\Interop\Windows\kernel32\Interop.WriteFile_SafeHandle_IntPtr.cs + + Common\CoreLib\Interop\Windows\Kernel32\Interop.WriteFile_SafeHandle_IntPtr.cs - - Common\Interop\Windows\kernel32\Interop.WriteFile_SafeHandle_NativeOverlapped.cs + + Common\CoreLib\Interop\Windows\Kernel32\Interop.WriteFile_SafeHandle_NativeOverlapped.cs Common\Interop\Windows\kernel32\Interop.GetOverlappedResult.cs - - Common\Interop\Windows\kernel32\Interop.FlushFileBuffers.cs + + Common\CoreLib\Interop\Windows\Kernel32\Interop.FlushFileBuffers.cs Common\Interop\Windows\kernel32\Interop.GenericOperations.cs @@ -125,11 +125,11 @@ Common\Interop\Windows\Interop.Errors.cs - - Common\Interop\Windows\Interop.BOOL.cs + + Common\CoreLib\Interop\Windows\Interop.BOOL.cs - - Common\Interop\Windows\kernel32\Interop.CloseHandle.cs + + Common\CoreLib\Interop\Windows\Kernel32\Interop.CloseHandle.cs diff --git a/src/libraries/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj b/src/libraries/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj index 6ae87d4..dc4843d 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj +++ b/src/libraries/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj @@ -1,4 +1,4 @@ - + @@ -30,8 +30,8 @@ up item called CompileItem and then just include it here. --> - - Common\System\IO\StreamHelpers.CopyValidation.cs + + Common\CoreLib\System\IO\StreamHelpers.CopyValidation.cs Common\System\Net\HttpVersionInternal.cs diff --git a/src/libraries/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.msbuild b/src/libraries/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.msbuild index 043e9c4..b7298f0 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.msbuild +++ b/src/libraries/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.msbuild @@ -27,7 +27,7 @@ - + diff --git a/src/libraries/System.Net.Http.WinHttpHandler/tests/UnitTests/System.Net.Http.WinHttpHandler.Unit.Tests.csproj b/src/libraries/System.Net.Http.WinHttpHandler/tests/UnitTests/System.Net.Http.WinHttpHandler.Unit.Tests.csproj index 31adaf0..c2937eb 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/tests/UnitTests/System.Net.Http.WinHttpHandler.Unit.Tests.csproj +++ b/src/libraries/System.Net.Http.WinHttpHandler/tests/UnitTests/System.Net.Http.WinHttpHandler.Unit.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -43,8 +43,8 @@ Common\System\StringExtensions.cs - - Common\System\IO\StreamHelpers.CopyValidation.cs + + Common\CoreLib\System\IO\StreamHelpers.CopyValidation.cs Common\System\Net\HttpKnownHeaderNames.cs @@ -85,8 +85,8 @@ Common\System\Threading\Tasks\RendezvousAwaitable.cs - - Common\System\Threading\Tasks\TaskToApm.cs + + Common\CoreLib\System\Threading\Tasks\TaskToApm.cs ProductionCode\WinHttpAuthHelper.cs diff --git a/src/libraries/System.Net.Http/src/System.Net.Http.csproj b/src/libraries/System.Net.Http/src/System.Net.Http.csproj index 3fa7cdd..e669250 100644 --- a/src/libraries/System.Net.Http/src/System.Net.Http.csproj +++ b/src/libraries/System.Net.Http/src/System.Net.Http.csproj @@ -1,4 +1,4 @@ - + @@ -100,8 +100,8 @@ - - Common\System\IO\StreamHelpers.CopyValidation.cs + + Common\CoreLib\System\IO\StreamHelpers.CopyValidation.cs Common\System\Net\HttpVersionInternal.cs @@ -278,8 +278,8 @@ Common\Interop\Windows\SChannel\Interop.SECURITY_STATUS.cs - - Common\Interop\Windows\kernel32\Interop.CloseHandle.cs + + Common\CoreLib\Interop\Windows\Kernel32\Interop.CloseHandle.cs Common\Interop\Windows\sspicli\SecPkgContext_StreamSizes.cs @@ -402,20 +402,20 @@ Common\Interop\Unix\Interop.Errors.cs - - Common\Interop\Unix\Interop.IOErrors.cs + + Common\CoreLib\Interop\Unix\Interop.IOErrors.cs Common\Interop\Unix\Interop.Libraries.cs - - Common\Interop\Unix\System.Native\Interop.Close.cs + + Common\CoreLib\Interop\Unix\System.Native\Interop.Close.cs - - Common\Interop\Unix\System.Native\Interop.Open.cs + + Common\CoreLib\Interop\Unix\System.Native\Interop.Open.cs - - Common\Interop\Unix\System.Native\Interop.OpenFlags.cs + + Common\CoreLib\Interop\Unix\System.Native\Interop.OpenFlags.cs Common\Interop\Unix\System.Native\Interop.Pipe.cs @@ -426,10 +426,10 @@ Common\Interop\Unix\libc\Interop.PrintF.cs - + Common\Interop\Unix\libc\Interop.Read.cs - + Common\Interop\Unix\libc\Interop.Write.cs @@ -480,8 +480,8 @@ Common\System\Net\Security\CertificateHelper.Unix.cs - - Common\System\Threading\Tasks\TaskToApm.cs + + Common\CoreLib\System\Threading\Tasks\TaskToApm.cs @@ -582,8 +582,8 @@ Common\System\StringExtensions.cs - - Common\System\Threading\Tasks\TaskToApm.cs + + Common\CoreLib\System\Threading\Tasks\TaskToApm.cs diff --git a/src/libraries/System.Net.Http/tests/UnitTests/System.Net.Http.Unit.Tests.csproj b/src/libraries/System.Net.Http/tests/UnitTests/System.Net.Http.Unit.Tests.csproj index cd2b2c9..f568af5 100644 --- a/src/libraries/System.Net.Http/tests/UnitTests/System.Net.Http.Unit.Tests.csproj +++ b/src/libraries/System.Net.Http/tests/UnitTests/System.Net.Http.Unit.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -30,8 +30,8 @@ ProductionCode\Common\System\IO\StringBuilderCache.cs - - ProductionCode\Common\System\IO\StreamHelpers.CopyValidation.cs + + ProductionCode\Common\CoreLib\System\IO\StreamHelpers.CopyValidation.cs ProductionCode\Common\System\Net\HttpKnownHeaderNames.cs @@ -81,8 +81,8 @@ ProductionCode\Common\src\System\Net\Mail\WhitespaceReader.cs - - ProductionCode\Common\System\Threading\Tasks\TaskToApm.cs + + ProductionCode\Common\CoreLib\System\Threading\Tasks\TaskToApm.cs ProductionCode\System\Net\Http\SocketsHttpHandler\AuthenticationHelper.Digest.cs diff --git a/src/libraries/System.Net.HttpListener/src/System.Net.HttpListener.csproj b/src/libraries/System.Net.HttpListener/src/System.Net.HttpListener.csproj index 5c614e0..41ceb19 100644 --- a/src/libraries/System.Net.HttpListener/src/System.Net.HttpListener.csproj +++ b/src/libraries/System.Net.HttpListener/src/System.Net.HttpListener.csproj @@ -1,4 +1,4 @@ - + @@ -145,8 +145,8 @@ Common\Interop\Windows\SChannel\Interop.SecPkgContext_ApplicationProtocol.cs - - Common\Interop\Windows\Interop.BOOL.cs + + Common\CoreLib\Interop\Windows\Interop.BOOL.cs Common\Interop\Windows\WebSocket\Interop.Structs.cs @@ -193,7 +193,7 @@ Interop\Windows\kernel32\Interop.SetFileCompletionNotificationModes.cs - + Common\Interop\Windows\mincore\Interop.CancelIoEx.cs @@ -288,8 +288,8 @@ Common\Interop\Windows\SChannel\Interop.SECURITY_STATUS.cs - - Common\Interop\Windows\kernel32\Interop.CloseHandle.cs + + Common\CoreLib\Interop\Windows\Kernel32\Interop.CloseHandle.cs Common\Interop\Windows\sspicli\SecPkgContext_StreamSizes.cs @@ -356,8 +356,8 @@ - - Common\System\Threading\Tasks\TaskToApm.cs + + Common\CoreLib\System\Threading\Tasks\TaskToApm.cs diff --git a/src/libraries/System.Net.Mail/src/System.Net.Mail.csproj b/src/libraries/System.Net.Mail/src/System.Net.Mail.csproj index fd32bce..ee98e46 100644 --- a/src/libraries/System.Net.Mail/src/System.Net.Mail.csproj +++ b/src/libraries/System.Net.Mail/src/System.Net.Mail.csproj @@ -1,4 +1,4 @@ - + @@ -236,8 +236,8 @@ Common\Interop\Windows\SChannel\Interop.SECURITY_STATUS.cs - - Common\Interop\Windows\kernel32\Interop.CloseHandle.cs + + Common\CoreLib\Interop\Windows\Kernel32\Interop.CloseHandle.cs Common\Interop\Windows\sspicli\SecPkgContext_StreamSizes.cs diff --git a/src/libraries/System.Net.NameResolution/src/System.Net.NameResolution.csproj b/src/libraries/System.Net.NameResolution/src/System.Net.NameResolution.csproj index ccf01dc..15d0776 100644 --- a/src/libraries/System.Net.NameResolution/src/System.Net.NameResolution.csproj +++ b/src/libraries/System.Net.NameResolution/src/System.Net.NameResolution.csproj @@ -1,4 +1,4 @@ - + @@ -167,7 +167,7 @@ Interop\Unix\Interop.Libraries.cs - + Interop\Unix\System.Native\Interop.Close.cs diff --git a/src/libraries/System.Net.NameResolution/tests/PalTests/System.Net.NameResolution.Pal.Tests.csproj b/src/libraries/System.Net.NameResolution/tests/PalTests/System.Net.NameResolution.Pal.Tests.csproj index 7ad7cfa..509912b 100644 --- a/src/libraries/System.Net.NameResolution/tests/PalTests/System.Net.NameResolution.Pal.Tests.csproj +++ b/src/libraries/System.Net.NameResolution/tests/PalTests/System.Net.NameResolution.Pal.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -166,7 +166,7 @@ Interop\Unix\Interop.Libraries.cs - + Interop\Unix\System.Native\Interop.Close.cs diff --git a/src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj b/src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj index e2a3f6a..8c519b9 100644 --- a/src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj +++ b/src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj @@ -1,4 +1,4 @@ - + @@ -261,8 +261,8 @@ Interop\Unix\Interop.Errors.cs - - Common\System\Threading\Tasks\TaskToApm.cs + + Common\CoreLib\System\Threading\Tasks\TaskToApm.cs Common\System\IO\RowConfigReader.cs diff --git a/src/libraries/System.Net.Ping/src/System.Net.Ping.csproj b/src/libraries/System.Net.Ping/src/System.Net.Ping.csproj index c823b9a..764a2d5 100644 --- a/src/libraries/System.Net.Ping/src/System.Net.Ping.csproj +++ b/src/libraries/System.Net.Ping/src/System.Net.Ping.csproj @@ -1,4 +1,4 @@ - + @@ -78,8 +78,8 @@ Common\Interop\Unix\Interop.Libraries.cs - - Common\Interop\Unix\System.Native\Interop.Close.cs + + Common\CoreLib\Interop\Unix\System.Native\Interop.Close.cs Common\Interop\Unix\System.Native\Interop.Socket.cs diff --git a/src/libraries/System.Net.Requests/src/System.Net.Requests.csproj b/src/libraries/System.Net.Requests/src/System.Net.Requests.csproj index 02ba7fd..2d53355 100644 --- a/src/libraries/System.Net.Requests/src/System.Net.Requests.csproj +++ b/src/libraries/System.Net.Requests/src/System.Net.Requests.csproj @@ -1,4 +1,4 @@ - + @@ -92,8 +92,8 @@ Common\System\NotImplemented.cs - - Common\System\Threading\Tasks\TaskToApm.cs + + Common\CoreLib\System\Threading\Tasks\TaskToApm.cs diff --git a/src/libraries/System.Net.Security/src/System.Net.Security.csproj b/src/libraries/System.Net.Security/src/System.Net.Security.csproj index 9dff201..1270199 100644 --- a/src/libraries/System.Net.Security/src/System.Net.Security.csproj +++ b/src/libraries/System.Net.Security/src/System.Net.Security.csproj @@ -1,4 +1,4 @@ - + @@ -91,8 +91,8 @@ Common\System\NotImplemented.cs - - Common\System\Threading\Tasks\TaskToApm.cs + + Common\CoreLib\System\Threading\Tasks\TaskToApm.cs Common\System\Net\Security\SecurityBuffer.cs @@ -149,8 +149,8 @@ Common\Interop\Windows\Crypt32\Interop.CertEnumCertificatesInStore.cs - - Common\Interop\Windows\kernel32\Interop.CloseHandle.cs + + Common\CoreLib\Interop\Windows\Kernel32\Interop.CloseHandle.cs Common\Interop\Windows\SChannel\Interop.Alerts.cs diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj b/src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj index c758241..6454247 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -84,8 +84,8 @@ Common\System\Threading\Tasks\TaskTimeoutExtensions.cs - - ProductionCode\Common\System\Threading\Tasks\TaskToApm.cs + + ProductionCode\Common\CoreLib\System\Threading\Tasks\TaskToApm.cs diff --git a/src/libraries/System.Net.Sockets/src/System.Net.Sockets.csproj b/src/libraries/System.Net.Sockets/src/System.Net.Sockets.csproj index 35a8203..c13ccd3 100644 --- a/src/libraries/System.Net.Sockets/src/System.Net.Sockets.csproj +++ b/src/libraries/System.Net.Sockets/src/System.Net.Sockets.csproj @@ -1,4 +1,4 @@ - + @@ -64,8 +64,8 @@ - - Common\System\IO\StreamHelpers.CopyValidation.cs + + Common\CoreLib\System\IO\StreamHelpers.CopyValidation.cs @@ -288,8 +288,8 @@ Common\System\Net\Sockets\SocketErrorPal.Unix - - Common\System\Threading\Tasks\TaskToApm.cs + + Common\CoreLib\System\Threading\Tasks\TaskToApm.cs Common\Interop\Unix\Interop.Errors.cs @@ -303,7 +303,7 @@ Interop\Unix\System.Native\Interop.Bind.cs - + Interop\Unix\System.Native\Interop.Close.cs @@ -390,7 +390,7 @@ Interop\Unix\System.Native\Interop.Pipe.cs - + Interop\Unix\System.Native\Interop.Write.cs diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/System.Net.Sockets.Tests.csproj b/src/libraries/System.Net.Sockets/tests/FunctionalTests/System.Net.Sockets.Tests.csproj index 8ef8f9b..ff98474 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/System.Net.Sockets.Tests.csproj +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/System.Net.Sockets.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -101,8 +101,8 @@ Common\System\Buffers\NativeMemoryManager.cs - - Common\System\Threading\Tasks\TaskToApm.cs + + Common\CoreLib\System\Threading\Tasks\TaskToApm.cs Common\System\Diagnostics\Tracing\TestEventListener.cs diff --git a/src/libraries/System.Runtime.Extensions/src/System.Runtime.Extensions.csproj b/src/libraries/System.Runtime.Extensions/src/System.Runtime.Extensions.csproj index c51a41e..87d84f5 100644 --- a/src/libraries/System.Runtime.Extensions/src/System.Runtime.Extensions.csproj +++ b/src/libraries/System.Runtime.Extensions/src/System.Runtime.Extensions.csproj @@ -1,4 +1,4 @@ - + @@ -67,11 +67,11 @@ - - Common\System\IO\StreamHelpers.CopyValidation.cs + + Common\CoreLib\System\IO\StreamHelpers.CopyValidation.cs - - Common\System\Threading\Tasks\TaskToApm.cs + + Common\CoreLib\System\Threading\Tasks\TaskToApm.cs Common\System\Collections\Generic\LowLevelDictionary.cs @@ -205,8 +205,8 @@ Common\Interop\Unix\Interop.Errors.cs - - Common\Interop\Unix\Interop.IOErrors.cs + + Common\CoreLib\Interop\Unix\Interop.IOErrors.cs Common\Interop\Unix\System.Native\Interop.GetPid.cs @@ -217,11 +217,11 @@ Common\Interop\Unix\System.Native\Interop.ChDir.cs - - Common\Interop\Unix\System.Native\Interop.Close.cs + + Common\CoreLib\Interop\Unix\System.Native\Interop.Close.cs - - Common\Interop\Unix\System.Native\Interop.GetCwd.cs + + Common\CoreLib\Interop\Unix\System.Native\Interop.GetCwd.cs Common\Interop\Unix\System.Native\Interop.GetEUid.cs @@ -241,14 +241,14 @@ Common\Interop\Unix\System.Native\Interop.GetUnixRelease.cs - - Common\Interop\Unix\System.Native\Interop.MksTemps.cs + + Common\CoreLib\Interop\Unix\System.Native\Interop.MksTemps.cs Common\Interop\Unix\System.Native\Interop.MountPoints.cs - - Common\Interop\Unix\System.Native\Interop.PathConf.cs + + Common\CoreLib\Interop\Unix\System.Native\Interop.PathConf.cs Common\Interop\Unix\System.Native\Interop.SysConf.cs diff --git a/src/libraries/System.Security.AccessControl/src/System.Security.AccessControl.csproj b/src/libraries/System.Security.AccessControl/src/System.Security.AccessControl.csproj index 477bf20..1ff0c80 100644 --- a/src/libraries/System.Security.AccessControl/src/System.Security.AccessControl.csproj +++ b/src/libraries/System.Security.AccessControl/src/System.Security.AccessControl.csproj @@ -1,4 +1,4 @@ - + @@ -94,7 +94,7 @@ Common\Interop\Interop.GetSecurityDescriptorLength.cs - + Common\Interop\Interop.CloseHandle.cs diff --git a/src/libraries/System.Security.Cryptography.Primitives/src/System.Security.Cryptography.Primitives.csproj b/src/libraries/System.Security.Cryptography.Primitives/src/System.Security.Cryptography.Primitives.csproj index 5e37c26..3fbc473 100644 --- a/src/libraries/System.Security.Cryptography.Primitives/src/System.Security.Cryptography.Primitives.csproj +++ b/src/libraries/System.Security.Cryptography.Primitives/src/System.Security.Cryptography.Primitives.csproj @@ -1,4 +1,4 @@ - + @@ -30,8 +30,8 @@ Common\System\Threading\Tasks\ForceAsyncAwaiter.cs - - Common\System\Threading\Tasks\TaskToApm.cs + + Common\CoreLib\System\Threading\Tasks\TaskToApm.cs diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/System.Security.Cryptography.X509Certificates.csproj b/src/libraries/System.Security.Cryptography.X509Certificates/src/System.Security.Cryptography.X509Certificates.csproj index d850e2e..8883c46 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/System.Security.Cryptography.X509Certificates.csproj +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/System.Security.Cryptography.X509Certificates.csproj @@ -1,4 +1,4 @@ - + @@ -178,8 +178,8 @@ Common\Interop\Unix\Interop.Errors.cs - - Common\Interop\Unix\System.Native\Interop.Permissions.cs + + Common\CoreLib\Interop\Unix\System.Native\Interop.Permissions.cs Common\Interop\Unix\System.Net.Http.Native\Interop.Initialization.cs @@ -238,7 +238,7 @@ Common\Interop\Unix\System.Security.Cryptography.Native\Interop.X509StoreCtx.cs - + Common\Interop\Unix\Interop.Close.cs @@ -250,8 +250,8 @@ Common\Interop\Unix\Interop.GetPwUid.cs - - Common\Interop\Unix\System.Native\Interop.Stat.cs + + Common\CoreLib\Interop\Unix\System.Native\Interop.Stat.cs Common\Interop\Unix\System.Net.Http.Native\Interop.CURLcode.cs diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/tests/System.Security.Cryptography.X509Certificates.Tests.csproj b/src/libraries/System.Security.Cryptography.X509Certificates/tests/System.Security.Cryptography.X509Certificates.Tests.csproj index 9c20960..c01c2f4 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/tests/System.Security.Cryptography.X509Certificates.Tests.csproj +++ b/src/libraries/System.Security.Cryptography.X509Certificates/tests/System.Security.Cryptography.X509Certificates.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -76,11 +76,11 @@ Common\Interop\Unix\System.Native\Interop.FChMod.cs - - Common\Interop\Unix\System.Native\Interop.Permissions.cs + + Common\CoreLib\Interop\Unix\System.Native\Interop.Permissions.cs - - Common\Interop\Unix\System.Native\Interop.Stat.cs + + Common\CoreLib\Interop\Unix\System.Native\Interop.Stat.cs Common\System\IO\PersistedFiles.Unix.cs diff --git a/src/libraries/System.Security.Principal.Windows/src/System.Security.Principal.Windows.csproj b/src/libraries/System.Security.Principal.Windows/src/System.Security.Principal.Windows.csproj index 1ff4d0a..63a3723 100644 --- a/src/libraries/System.Security.Principal.Windows/src/System.Security.Principal.Windows.csproj +++ b/src/libraries/System.Security.Principal.Windows/src/System.Security.Principal.Windows.csproj @@ -1,4 +1,4 @@ - + @@ -83,7 +83,7 @@ Common\Interop\Interop.DuplicateHandle.cs - + Common\Interop\Interop.CloseHandle.cs diff --git a/src/libraries/System.Threading.Overlapped/src/System/Threading/DeferredDisposableLifetime.cs b/src/libraries/System.Threading.Overlapped/src/System/Threading/DeferredDisposableLifetime.cs deleted file mode 100644 index e2b1eb9..0000000 --- a/src/libraries/System.Threading.Overlapped/src/System/Threading/DeferredDisposableLifetime.cs +++ /dev/null @@ -1,116 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; - -namespace System.Threading -{ - /// - /// Provides callbacks to objects whose lifetime is managed by . - /// - internal interface IDeferredDisposable - { - /// - /// Called when the object's refcount reaches zero. - /// - /// - /// Indicates whether the object has been disposed. - /// - /// - /// If the refcount reaches zero before the object is disposed, this method will be called with - /// set to false. If the object is then disposed, this method will be - /// called again, with set to true. If the refcount reaches zero - /// after the object has already been disposed, this will be called a single time, with - /// set to true. - /// - void OnFinalRelease(bool disposed); - } - - /// - /// Manages the lifetime of an object which implements IDisposable, but which must defer the actual - /// cleanup of state until all existing uses of the object are complete. - /// - /// The type of object whose lifetime will be managed. - /// - /// This type maintains a reference count, and tracks whether the object has been disposed. When - /// Callbacks are made to when the refcount - /// reaches zero. Objects that need to defer cleanup until they have been disposed *and* they have - /// no more references can do so in when - /// 'disposed' is true. - /// - internal struct DeferredDisposableLifetime where T : class, IDeferredDisposable - { - // - // _count is positive until Dispose is called, after which it's (-1 - refcount). - // - private int _count; - - public bool AddRef(T obj) - { - while (true) - { - int oldCount = Volatile.Read(ref _count); - - // Have we been disposed? - if (oldCount < 0) - throw new ObjectDisposedException(typeof(T).ToString()); - - int newCount = checked(oldCount + 1); - - if (Interlocked.CompareExchange(ref _count, newCount, oldCount) == oldCount) - return true; - } - } - - public void Release(T obj) - { - while (true) - { - int oldCount = Volatile.Read(ref _count); - if (oldCount > 0) - { - // We haven't been disposed. Decrement _count. - int newCount = oldCount - 1; - if (Interlocked.CompareExchange(ref _count, newCount, oldCount) == oldCount) - { - if (newCount == 0) - obj.OnFinalRelease(disposed: false); - return; - } - } - else - { - Debug.Assert(oldCount != 0 && oldCount != -1); - - // We've been disposed. Increment _count. - int newCount = oldCount + 1; - if (Interlocked.CompareExchange(ref _count, newCount, oldCount) == oldCount) - { - if (newCount == -1) - obj.OnFinalRelease(disposed: true); - return; - } - } - } - } - - public void Dispose(T obj) - { - while (true) - { - int oldCount = Volatile.Read(ref _count); - if (oldCount < 0) - return; // already disposed - - int newCount = -1 - oldCount; - if (Interlocked.CompareExchange(ref _count, newCount, oldCount) == oldCount) - { - if (newCount == -1) - obj.OnFinalRelease(disposed: true); - return; - } - } - } - } -} -- 2.7.4