Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
runtime
提交
760b7c61
R
runtime
项目概览
dotNET Platform
/
runtime
大约 1 年 前同步成功
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
runtime
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
760b7c61
编写于
11月 23, 2019
作者:
S
Stephen Toub
提交者:
GitHub
11月 23, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Annotate System.IO.MemoryMappedFiles for nullable reference types (#220)
上级
7bc6a674
变更
25
显示空白变更内容
内联
并排
Showing
25 changed file
with
31 addition
and
56 deletion
+31
-56
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.CreateFileMapping.cs
...src/Interop/Windows/Kernel32/Interop.CreateFileMapping.cs
+3
-2
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.MEMORY_BASIC_INFO.cs
...src/Interop/Windows/Kernel32/Interop.MEMORY_BASIC_INFO.cs
+0
-1
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.OpenFileMapping.cs
...n/src/Interop/Windows/Kernel32/Interop.OpenFileMapping.cs
+0
-1
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.VirtualAlloc.cs
...mmon/src/Interop/Windows/Kernel32/Interop.VirtualAlloc.cs
+0
-1
src/libraries/System.IO.MemoryMappedFiles/ref/System.IO.MemoryMappedFiles.cs
...m.IO.MemoryMappedFiles/ref/System.IO.MemoryMappedFiles.cs
+7
-7
src/libraries/System.IO.MemoryMappedFiles/ref/System.IO.MemoryMappedFiles.csproj
....MemoryMappedFiles/ref/System.IO.MemoryMappedFiles.csproj
+1
-0
src/libraries/System.IO.MemoryMappedFiles/src/Microsoft/Win32/SafeMemoryMappedFileHandle.Unix.cs
...es/src/Microsoft/Win32/SafeMemoryMappedFileHandle.Unix.cs
+3
-5
src/libraries/System.IO.MemoryMappedFiles/src/Microsoft/Win32/SafeMemoryMappedFileHandle.Windows.cs
...src/Microsoft/Win32/SafeMemoryMappedFileHandle.Windows.cs
+0
-4
src/libraries/System.IO.MemoryMappedFiles/src/Microsoft/Win32/SafeMemoryMappedViewHandle.Windows.cs
...src/Microsoft/Win32/SafeMemoryMappedViewHandle.Windows.cs
+0
-1
src/libraries/System.IO.MemoryMappedFiles/src/Microsoft/Win32/SafeMemoryMappedViewHandle.cs
...edFiles/src/Microsoft/Win32/SafeMemoryMappedViewHandle.cs
+0
-2
src/libraries/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj
....MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj
+1
-0
src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/Interop.Windows.cs
...dFiles/src/System/IO/MemoryMappedFiles/Interop.Windows.cs
+2
-2
src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.Unix.cs
.../src/System/IO/MemoryMappedFiles/MemoryMappedFile.Unix.cs
+2
-3
src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.Windows.cs
...c/System/IO/MemoryMappedFiles/MemoryMappedFile.Windows.cs
+3
-4
src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.cs
...Files/src/System/IO/MemoryMappedFiles/MemoryMappedFile.cs
+9
-10
src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedView.Unix.cs
.../src/System/IO/MemoryMappedFiles/MemoryMappedView.Unix.cs
+0
-2
src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedView.Windows.cs
...c/System/IO/MemoryMappedFiles/MemoryMappedView.Windows.cs
+0
-2
src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedView.cs
...Files/src/System/IO/MemoryMappedFiles/MemoryMappedView.cs
+0
-1
src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedViewAccessor.cs
...c/System/IO/MemoryMappedFiles/MemoryMappedViewAccessor.cs
+0
-1
src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedViewStream.cs
...src/System/IO/MemoryMappedFiles/MemoryMappedViewStream.cs
+0
-1
src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CrossProcess.cs
....MemoryMappedFiles/tests/MemoryMappedFile.CrossProcess.cs
+0
-1
src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFilesTestsBase.Windows.cs
...ryMappedFiles/tests/MemoryMappedFilesTestsBase.Windows.cs
+0
-2
src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFilesTestsBase.cs
....IO.MemoryMappedFiles/tests/MemoryMappedFilesTestsBase.cs
+0
-1
src/libraries/System.Private.CoreLib/src/Interop/Unix/Interop.IOErrors.cs
...stem.Private.CoreLib/src/Interop/Unix/Interop.IOErrors.cs
+0
-1
src/libraries/System.Private.CoreLib/src/Interop/Unix/System.Native/Interop.Unlink.cs
....CoreLib/src/Interop/Unix/System.Native/Interop.Unlink.cs
+0
-1
未找到文件。
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.CreateFileMapping.cs
浏览文件 @
760b7c61
...
...
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#
nullable
enable
using
Microsoft.Win32.SafeHandles
;
using
System
;
using
System.Runtime.InteropServices
;
...
...
@@ -17,7 +18,7 @@ internal partial class Kernel32
int
flProtect
,
int
dwMaximumSizeHigh
,
int
dwMaximumSizeLow
,
string
lpName
);
string
?
lpName
);
[
DllImport
(
Libraries
.
Kernel32
,
EntryPoint
=
"CreateFileMappingW"
,
CharSet
=
CharSet
.
Unicode
,
SetLastError
=
true
)]
internal
static
extern
SafeMemoryMappedFileHandle
CreateFileMapping
(
...
...
@@ -26,6 +27,6 @@ internal partial class Kernel32
int
flProtect
,
int
dwMaximumSizeHigh
,
int
dwMaximumSizeLow
,
string
lpName
);
string
?
lpName
);
}
}
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.MEMORY_BASIC_INFO.cs
浏览文件 @
760b7c61
...
...
@@ -2,7 +2,6 @@
// 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
;
...
...
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.OpenFileMapping.cs
浏览文件 @
760b7c61
...
...
@@ -3,7 +3,6 @@
// 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
...
...
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.VirtualAlloc.cs
浏览文件 @
760b7c61
...
...
@@ -2,7 +2,6 @@
// 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
;
...
...
src/libraries/System.IO.MemoryMappedFiles/ref/System.IO.MemoryMappedFiles.cs
浏览文件 @
760b7c61
...
...
@@ -25,15 +25,15 @@ public partial class MemoryMappedFile : System.IDisposable
{
internal
MemoryMappedFile
()
{
}
public
Microsoft
.
Win32
.
SafeHandles
.
SafeMemoryMappedFileHandle
SafeMemoryMappedFileHandle
{
get
{
throw
null
;
}
}
public
static
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFile
CreateFromFile
(
System
.
IO
.
FileStream
fileStream
,
string
mapName
,
long
capacity
,
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFileAccess
access
,
System
.
IO
.
HandleInheritability
inheritability
,
bool
leaveOpen
)
{
throw
null
;
}
public
static
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFile
CreateFromFile
(
System
.
IO
.
FileStream
fileStream
,
string
?
mapName
,
long
capacity
,
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFileAccess
access
,
System
.
IO
.
HandleInheritability
inheritability
,
bool
leaveOpen
)
{
throw
null
;
}
public
static
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFile
CreateFromFile
(
string
path
)
{
throw
null
;
}
public
static
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFile
CreateFromFile
(
string
path
,
System
.
IO
.
FileMode
mode
)
{
throw
null
;
}
public
static
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFile
CreateFromFile
(
string
path
,
System
.
IO
.
FileMode
mode
,
string
mapName
)
{
throw
null
;
}
public
static
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFile
CreateFromFile
(
string
path
,
System
.
IO
.
FileMode
mode
,
string
mapName
,
long
capacity
)
{
throw
null
;
}
public
static
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFile
CreateFromFile
(
string
path
,
System
.
IO
.
FileMode
mode
,
string
mapName
,
long
capacity
,
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFileAccess
access
)
{
throw
null
;
}
public
static
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFile
CreateNew
(
string
mapName
,
long
capacity
)
{
throw
null
;
}
public
static
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFile
CreateNew
(
string
mapName
,
long
capacity
,
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFileAccess
access
)
{
throw
null
;
}
public
static
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFile
CreateNew
(
string
mapName
,
long
capacity
,
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFileAccess
access
,
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFileOptions
options
,
System
.
IO
.
HandleInheritability
inheritability
)
{
throw
null
;
}
public
static
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFile
CreateFromFile
(
string
path
,
System
.
IO
.
FileMode
mode
,
string
?
mapName
)
{
throw
null
;
}
public
static
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFile
CreateFromFile
(
string
path
,
System
.
IO
.
FileMode
mode
,
string
?
mapName
,
long
capacity
)
{
throw
null
;
}
public
static
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFile
CreateFromFile
(
string
path
,
System
.
IO
.
FileMode
mode
,
string
?
mapName
,
long
capacity
,
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFileAccess
access
)
{
throw
null
;
}
public
static
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFile
CreateNew
(
string
?
mapName
,
long
capacity
)
{
throw
null
;
}
public
static
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFile
CreateNew
(
string
?
mapName
,
long
capacity
,
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFileAccess
access
)
{
throw
null
;
}
public
static
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFile
CreateNew
(
string
?
mapName
,
long
capacity
,
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFileAccess
access
,
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFileOptions
options
,
System
.
IO
.
HandleInheritability
inheritability
)
{
throw
null
;
}
public
static
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFile
CreateOrOpen
(
string
mapName
,
long
capacity
)
{
throw
null
;
}
public
static
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFile
CreateOrOpen
(
string
mapName
,
long
capacity
,
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFileAccess
access
)
{
throw
null
;
}
public
static
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFile
CreateOrOpen
(
string
mapName
,
long
capacity
,
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFileAccess
access
,
System
.
IO
.
MemoryMappedFiles
.
MemoryMappedFileOptions
options
,
System
.
IO
.
HandleInheritability
inheritability
)
{
throw
null
;
}
...
...
src/libraries/System.IO.MemoryMappedFiles/ref/System.IO.MemoryMappedFiles.csproj
浏览文件 @
760b7c61
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Nullable>enable</Nullable>
<Configurations>netcoreapp-Debug;netcoreapp-Release</Configurations>
</PropertyGroup>
<ItemGroup>
...
...
src/libraries/System.IO.MemoryMappedFiles/src/Microsoft/Win32/SafeMemoryMappedFileHandle.Unix.cs
浏览文件 @
760b7c61
...
...
@@ -6,8 +6,6 @@
using
System.Diagnostics
;
using
System.IO
;
using
System.IO.MemoryMappedFiles
;
using
System.Runtime.InteropServices
;
using
System.Security
;
using
System.Threading
;
namespace
Microsoft.Win32.SafeHandles
...
...
@@ -22,7 +20,7 @@ public sealed partial class SafeMemoryMappedFileHandle : SafeHandleZeroOrMinusOn
/// onto the underlying handle to ensure that logic associated with disposing the stream
/// (e.g. deleting the file for DeleteOnClose) happens at the appropriate time.
/// </summary>
internal
readonly
FileStream
_fileStream
;
internal
readonly
FileStream
?
_fileStream
;
/// <summary>Whether this SafeHandle owns the _fileStream and should Dispose it when disposed.</summary>
internal
readonly
bool
_ownsFileStream
;
...
...
@@ -47,7 +45,7 @@ public sealed partial class SafeMemoryMappedFileHandle : SafeHandleZeroOrMinusOn
/// <param name="options">The options for the memory-mapped file.</param>
/// <param name="capacity">The capacity of the memory-mapped file.</param>
internal
SafeMemoryMappedFileHandle
(
FileStream
fileStream
,
bool
ownsFileStream
,
HandleInheritability
inheritability
,
FileStream
?
fileStream
,
bool
ownsFileStream
,
HandleInheritability
inheritability
,
MemoryMappedFileAccess
access
,
MemoryMappedFileOptions
options
,
long
capacity
)
:
base
(
ownsHandle
:
true
)
...
...
@@ -72,7 +70,7 @@ protected override void Dispose(bool disposing)
if
(
disposing
&&
_ownsFileStream
)
{
// Clean up the file descriptor (either for a file on disk or a shared memory object) if we created it
_fileStream
.
Dispose
();
_fileStream
!
.
Dispose
();
}
base
.
Dispose
(
disposing
);
}
...
...
src/libraries/System.IO.MemoryMappedFiles/src/Microsoft/Win32/SafeMemoryMappedFileHandle.Windows.cs
浏览文件 @
760b7c61
...
...
@@ -2,10 +2,6 @@
// 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
System.Security
;
namespace
Microsoft.Win32.SafeHandles
{
public
sealed
partial
class
SafeMemoryMappedFileHandle
:
SafeHandleZeroOrMinusOneIsInvalid
...
...
src/libraries/System.IO.MemoryMappedFiles/src/Microsoft/Win32/SafeMemoryMappedViewHandle.Windows.cs
浏览文件 @
760b7c61
...
...
@@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
using
System
;
using
System.Runtime.InteropServices
;
namespace
Microsoft.Win32.SafeHandles
{
...
...
src/libraries/System.IO.MemoryMappedFiles/src/Microsoft/Win32/SafeMemoryMappedViewHandle.cs
浏览文件 @
760b7c61
...
...
@@ -2,9 +2,7 @@
// 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
System.Security
;
namespace
Microsoft.Win32.SafeHandles
{
...
...
src/libraries/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj
浏览文件 @
760b7c61
...
...
@@ -2,6 +2,7 @@
<PropertyGroup>
<AssemblyName>System.IO.MemoryMappedFiles</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Nullable>enable</Nullable>
<Configurations>netcoreapp-Unix-Debug;netcoreapp-Unix-Release;netcoreapp-Windows_NT-Debug;netcoreapp-Windows_NT-Release</Configurations>
</PropertyGroup>
<!-- Compiled Source Files -->
...
...
src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/Interop.Windows.cs
浏览文件 @
760b7c61
...
...
@@ -27,7 +27,7 @@ public static unsafe void CheckForAvailableVirtualMemory(ulong nativeSize)
ref
Kernel32
.
SECURITY_ATTRIBUTES
securityAttributes
,
int
pageProtection
,
long
maximumSize
,
string
name
)
string
?
name
)
{
// split the long into two ints
int
capacityHigh
,
capacityLow
;
...
...
@@ -41,7 +41,7 @@ public static unsafe void CheckForAvailableVirtualMemory(ulong nativeSize)
ref
Kernel32
.
SECURITY_ATTRIBUTES
securityAttributes
,
int
pageProtection
,
long
maximumSize
,
string
name
)
string
?
name
)
{
// split the long into two ints
int
capacityHigh
,
capacityLow
;
...
...
src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.Unix.cs
浏览文件 @
760b7c61
...
...
@@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
using
Microsoft.Win32.SafeHandles
;
using
System.Security
;
namespace
System.IO.MemoryMappedFiles
{
...
...
@@ -15,7 +14,7 @@ public partial class MemoryMappedFile
/// out empty).
/// </summary>
private
static
unsafe
SafeMemoryMappedFileHandle
CreateCore
(
FileStream
fileStream
,
string
mapName
,
FileStream
?
fileStream
,
string
?
mapName
,
HandleInheritability
inheritability
,
MemoryMappedFileAccess
access
,
MemoryMappedFileOptions
options
,
long
capacity
)
{
...
...
@@ -138,7 +137,7 @@ private static FileStream CreateSharedBackingObject(Interop.Sys.MemoryMappedProt
// ---- PAL layer ends here ----
// -----------------------------
private
static
FileStream
CreateSharedBackingObjectUsingMemory
(
private
static
FileStream
?
CreateSharedBackingObjectUsingMemory
(
Interop
.
Sys
.
MemoryMappedProtections
protections
,
long
capacity
,
HandleInheritability
inheritability
)
{
// The POSIX shared memory object name must begin with '/'. After that we just want something short and unique.
...
...
src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.Windows.cs
浏览文件 @
760b7c61
...
...
@@ -5,7 +5,6 @@
using
Microsoft.Win32.SafeHandles
;
using
System.Diagnostics
;
using
System.Runtime.InteropServices
;
using
System.Security
;
using
System.Threading
;
namespace
System.IO.MemoryMappedFiles
...
...
@@ -19,10 +18,10 @@ public partial class MemoryMappedFile
/// </summary>
private
static
SafeMemoryMappedFileHandle
CreateCore
(
FileStream
fileStream
,
string
mapName
,
HandleInheritability
inheritability
,
FileStream
?
fileStream
,
string
?
mapName
,
HandleInheritability
inheritability
,
MemoryMappedFileAccess
access
,
MemoryMappedFileOptions
options
,
long
capacity
)
{
SafeFileHandle
fileHandle
=
fileStream
!=
null
?
fileStream
.
SafeFileHandle
:
null
;
SafeFileHandle
?
fileHandle
=
fileStream
!=
null
?
fileStream
.
SafeFileHandle
:
null
;
Interop
.
Kernel32
.
SECURITY_ATTRIBUTES
secAttrs
=
GetSecAttrs
(
inheritability
);
...
...
@@ -89,7 +88,7 @@ public partial class MemoryMappedFile
Debug
.
Assert
(
access
!=
MemoryMappedFileAccess
.
Write
,
"Callers requesting write access shouldn't try to create a mmf"
);
SafeMemoryMappedFileHandle
handle
=
null
;
SafeMemoryMappedFileHandle
?
handle
=
null
;
Interop
.
Kernel32
.
SECURITY_ATTRIBUTES
secAttrs
=
GetSecAttrs
(
inheritability
);
int
waitRetries
=
14
;
//((2^13)-1)*10ms == approximately 1.4mins
...
...
src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.cs
浏览文件 @
760b7c61
...
...
@@ -4,7 +4,6 @@
using
Microsoft.Win32.SafeHandles
;
using
System.Diagnostics
;
using
System.Security
;
namespace
System.IO.MemoryMappedFiles
{
...
...
@@ -12,7 +11,7 @@ public partial class MemoryMappedFile : IDisposable
{
private
readonly
SafeMemoryMappedFileHandle
_handle
;
private
readonly
bool
_leaveOpen
;
private
readonly
FileStream
_fileStream
;
private
readonly
FileStream
?
_fileStream
;
internal
const
int
DefaultSize
=
0
;
// Private constructors to be used by the factory methods.
...
...
@@ -99,17 +98,17 @@ public static MemoryMappedFile CreateFromFile(string path, FileMode mode)
return
CreateFromFile
(
path
,
mode
,
null
,
DefaultSize
,
MemoryMappedFileAccess
.
ReadWrite
);
}
public
static
MemoryMappedFile
CreateFromFile
(
string
path
,
FileMode
mode
,
string
mapName
)
public
static
MemoryMappedFile
CreateFromFile
(
string
path
,
FileMode
mode
,
string
?
mapName
)
{
return
CreateFromFile
(
path
,
mode
,
mapName
,
DefaultSize
,
MemoryMappedFileAccess
.
ReadWrite
);
}
public
static
MemoryMappedFile
CreateFromFile
(
string
path
,
FileMode
mode
,
string
mapName
,
long
capacity
)
public
static
MemoryMappedFile
CreateFromFile
(
string
path
,
FileMode
mode
,
string
?
mapName
,
long
capacity
)
{
return
CreateFromFile
(
path
,
mode
,
mapName
,
capacity
,
MemoryMappedFileAccess
.
ReadWrite
);
}
public
static
MemoryMappedFile
CreateFromFile
(
string
path
,
FileMode
mode
,
string
mapName
,
long
capacity
,
public
static
MemoryMappedFile
CreateFromFile
(
string
path
,
FileMode
mode
,
string
?
mapName
,
long
capacity
,
MemoryMappedFileAccess
access
)
{
if
(
path
==
null
)
...
...
@@ -173,7 +172,7 @@ public static MemoryMappedFile CreateFromFile(string path, FileMode mode, string
throw
new
ArgumentOutOfRangeException
(
nameof
(
capacity
),
SR
.
ArgumentOutOfRange_CapacityGEFileSizeRequired
);
}
SafeMemoryMappedFileHandle
handle
=
null
;
SafeMemoryMappedFileHandle
?
handle
=
null
;
try
{
handle
=
CreateCore
(
fileStream
,
mapName
,
HandleInheritability
.
None
,
...
...
@@ -190,7 +189,7 @@ public static MemoryMappedFile CreateFromFile(string path, FileMode mode, string
return
new
MemoryMappedFile
(
handle
,
fileStream
,
false
);
}
public
static
MemoryMappedFile
CreateFromFile
(
FileStream
fileStream
,
string
mapName
,
long
capacity
,
public
static
MemoryMappedFile
CreateFromFile
(
FileStream
fileStream
,
string
?
mapName
,
long
capacity
,
MemoryMappedFileAccess
access
,
HandleInheritability
inheritability
,
bool
leaveOpen
)
{
...
...
@@ -257,19 +256,19 @@ public static MemoryMappedFile CreateFromFile(string path, FileMode mode, string
// Factory Method Group #3: Creates a new empty memory mapped file. Such memory mapped files are ideal
// for IPC, when mapName != null.
public
static
MemoryMappedFile
CreateNew
(
string
mapName
,
long
capacity
)
public
static
MemoryMappedFile
CreateNew
(
string
?
mapName
,
long
capacity
)
{
return
CreateNew
(
mapName
,
capacity
,
MemoryMappedFileAccess
.
ReadWrite
,
MemoryMappedFileOptions
.
None
,
HandleInheritability
.
None
);
}
public
static
MemoryMappedFile
CreateNew
(
string
mapName
,
long
capacity
,
MemoryMappedFileAccess
access
)
public
static
MemoryMappedFile
CreateNew
(
string
?
mapName
,
long
capacity
,
MemoryMappedFileAccess
access
)
{
return
CreateNew
(
mapName
,
capacity
,
access
,
MemoryMappedFileOptions
.
None
,
HandleInheritability
.
None
);
}
public
static
MemoryMappedFile
CreateNew
(
string
mapName
,
long
capacity
,
MemoryMappedFileAccess
access
,
public
static
MemoryMappedFile
CreateNew
(
string
?
mapName
,
long
capacity
,
MemoryMappedFileAccess
access
,
MemoryMappedFileOptions
options
,
HandleInheritability
inheritability
)
{
...
...
src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedView.Unix.cs
浏览文件 @
760b7c61
...
...
@@ -4,8 +4,6 @@
using
Microsoft.Win32.SafeHandles
;
using
System.Diagnostics
;
using
System.Runtime.InteropServices
;
using
System.Security
;
namespace
System.IO.MemoryMappedFiles
{
...
...
src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedView.Windows.cs
浏览文件 @
760b7c61
...
...
@@ -5,9 +5,7 @@
using
Microsoft.Win32.SafeHandles
;
using
System.Diagnostics
;
using
System.Runtime.InteropServices
;
using
System.Security
;
using
System.Threading
;
using
System.Threading.Tasks
;
namespace
System.IO.MemoryMappedFiles
{
...
...
src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedView.cs
浏览文件 @
760b7c61
...
...
@@ -4,7 +4,6 @@
using
Microsoft.Win32.SafeHandles
;
using
System.Diagnostics
;
using
System.Security
;
namespace
System.IO.MemoryMappedFiles
{
...
...
src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedViewAccessor.cs
浏览文件 @
760b7c61
...
...
@@ -4,7 +4,6 @@
using
Microsoft.Win32.SafeHandles
;
using
System.Diagnostics
;
using
System.Security
;
namespace
System.IO.MemoryMappedFiles
{
...
...
src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedViewStream.cs
浏览文件 @
760b7c61
...
...
@@ -4,7 +4,6 @@
using
Microsoft.Win32.SafeHandles
;
using
System.Diagnostics
;
using
System.Security
;
namespace
System.IO.MemoryMappedFiles
{
...
...
src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CrossProcess.cs
浏览文件 @
760b7c61
...
...
@@ -2,7 +2,6 @@
// 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
;
using
Microsoft.DotNet.RemoteExecutor
;
using
Xunit
;
...
...
src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFilesTestsBase.Windows.cs
浏览文件 @
760b7c61
...
...
@@ -2,8 +2,6 @@
// 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.Collections.Generic
;
using
System.Runtime.CompilerServices
;
using
System.Runtime.InteropServices
;
using
Xunit
;
...
...
src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFilesTestsBase.cs
浏览文件 @
760b7c61
...
...
@@ -5,7 +5,6 @@
using
System.Collections.Generic
;
using
System.Runtime.CompilerServices
;
using
System.Runtime.InteropServices
;
using
System.Text
;
using
Xunit
;
namespace
System.IO.MemoryMappedFiles.Tests
...
...
src/libraries/System.Private.CoreLib/src/Interop/Unix/Interop.IOErrors.cs
浏览文件 @
760b7c61
...
...
@@ -7,7 +7,6 @@
using
System.Diagnostics
;
using
System.IO
;
using
System.Runtime.InteropServices
;
using
Microsoft.Win32.SafeHandles
;
internal
static
partial
class
Interop
{
...
...
src/libraries/System.Private.CoreLib/src/Interop/Unix/System.Native/Interop.Unlink.cs
浏览文件 @
760b7c61
...
...
@@ -2,7 +2,6 @@
// 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
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录