115 references to Interop
System.IO.MemoryMappedFiles (115)
LibraryImports.g.cs (15)
7
internal static extern partial global::
Interop
.Error ConvertErrorPlatformToPal(int platformErrno);
15
internal static extern partial int ConvertErrorPalToPlatform(global::
Interop
.Error error);
31
internal static unsafe extern partial global::
Interop
.Error GetSocketAddressSizes(int* ipv4SocketAddressSize, int* ipv6SocketAddressSize, int* udsSocketAddressSize, int* maxSocketAddressSize);
39
internal static unsafe extern partial global::
Interop
.Error GetAddressFamily(byte* socketAddress, int socketAddressLen, int* addressFamily);
47
internal static unsafe extern partial global::
Interop
.Error SetAddressFamily(byte* socketAddress, int socketAddressLen, int addressFamily);
55
internal static unsafe extern partial global::
Interop
.Error GetPort(byte* socketAddress, int socketAddressLen, ushort* port);
63
internal static unsafe extern partial global::
Interop
.Error SetPort(byte* socketAddress, int socketAddressLen, ushort port);
71
internal static unsafe extern partial global::
Interop
.Error GetIPv4Address(byte* socketAddress, int socketAddressLen, uint* address);
79
internal static unsafe extern partial global::
Interop
.Error SetIPv4Address(byte* socketAddress, int socketAddressLen, uint address);
87
internal static unsafe extern partial global::
Interop
.Error GetIPv6Address(byte* socketAddress, int socketAddressLen, byte* address, int addressLen, uint* scopeId);
95
internal static unsafe extern partial global::
Interop
.Error SetIPv6Address(byte* socketAddress, int socketAddressLen, byte* address, int addressLen, uint scopeId);
134
internal static unsafe extern partial int GetNameInfo(byte* address, uint addressLength, byte isIpv6, byte* host, uint hostLength, byte* service, uint serviceLength, global::
Interop
.Sys.GetNameInfoFlags flags);
142
internal static unsafe partial int GetHostEntryForName(string address, global::System.Net.Sockets.AddressFamily family, global::
Interop
.Sys.HostEntry* entry)
167
static extern unsafe int __PInvoke(byte* __address_native, global::System.Net.Sockets.AddressFamily __family_native, global::
Interop
.Sys.HostEntry* __entry_native);
176
internal static unsafe extern partial void FreeHostEntry(global::
Interop
.Sys.HostEntry* entry);
Microsoft\Win32\SafeMemoryMappedViewHandle.Unix.cs (1)
20
return
Interop
.Sys.MUnmap(addr, base.ByteLength) == 0;
src\libraries\Common\src\Interop\Unix\Interop.Errors.cs (6)
124
_error =
Interop
.Sys.ConvertErrorPlatformToPal(errno);
141
get { return _rawErrno == -1 ? (_rawErrno =
Interop
.Sys.ConvertErrorPalToPlatform(_error)) : _rawErrno; }
146
return
Interop
.Sys.StrError(RawErrno);
220
public static
Interop
.ErrorInfo Info(this
Interop
.Error error)
222
return new
Interop
.ErrorInfo(error);
src\libraries\Common\src\Interop\Unix\Interop.IOErrors.cs (4)
16
throw
Interop
.GetExceptionForIoErrno(errorInfo, path, isDirError);
21
if (error !=
Interop
.Error.SUCCESS)
99
Exception e =
Interop
.GetExceptionForIoErrno(Sys.GetLastErrorInfo(), path, isDirError);
179
internal static Exception GetIOException(
Interop
.ErrorInfo errorInfo, string? path = null)
System\IO\MemoryMappedFiles\MemoryMappedFile.Unix.cs (55)
39
Interop
.CheckIo(
Interop
.Sys.FStat(fileHandle, out
Interop
.Sys.FileStatus status));
40
return (status.Mode &
Interop
.Sys.FileTypes.S_IFREG) != 0;
79
Interop
.CheckIo(
Interop
.Sys.FTruncate(fileHandle, capacity));
101
Interop
.Sys.MemoryMappedProtections protections = MemoryMappedView.GetProtections(access, forVerification: false);
102
if ((protections &
Interop
.Sys.MemoryMappedProtections.PROT_WRITE) != 0 && capacity > 0)
155
private static FileAccess TranslateProtectionsToFileAccess(
Interop
.Sys.MemoryMappedProtections protections)
158
(protections & (
Interop
.Sys.MemoryMappedProtections.PROT_READ |
Interop
.Sys.MemoryMappedProtections.PROT_WRITE)) != 0 ? FileAccess.ReadWrite :
159
(protections & (
Interop
.Sys.MemoryMappedProtections.PROT_WRITE)) != 0 ? FileAccess.Write :
163
private static SafeFileHandle CreateSharedBackingObject(
Interop
.Sys.MemoryMappedProtections protections, long capacity, HandleInheritability inheritability)
165
return
Interop
.Sys.IsMemfdSupported ?
172
Interop
.Sys.MemoryMappedProtections protections, long capacity, HandleInheritability inheritability)
175
Interop
.Sys.OpenFlags flags = (protections &
Interop
.Sys.MemoryMappedProtections.PROT_WRITE) != 0 ?
176
Interop
.Sys.OpenFlags.O_RDWR :
177
Interop
.Sys.OpenFlags.O_RDONLY;
178
flags |=
Interop
.Sys.OpenFlags.O_CREAT |
Interop
.Sys.OpenFlags.O_EXCL; // CreateNew
182
if ((protections &
Interop
.Sys.MemoryMappedProtections.PROT_READ) != 0)
184
if ((protections &
Interop
.Sys.MemoryMappedProtections.PROT_WRITE) != 0)
186
if ((protections &
Interop
.Sys.MemoryMappedProtections.PROT_EXEC) != 0)
195
fd =
Interop
.Sys.ShmOpen(mapName, flags, (int)perms); // Create the shared memory object.
199
Interop
.ErrorInfo errorInfo =
Interop
.Sys.GetLastErrorInfo();
202
if (errorInfo.Error ==
Interop
.Error.ENOTSUP)
209
else if (errorInfo.Error ==
Interop
.Error.ENAMETOOLONG)
215
else if (errorInfo.Error !=
Interop
.Error.EEXIST) // map with same name already existed
217
throw
Interop
.GetExceptionForIoErrno(errorInfo);
227
Interop
.CheckIo(
Interop
.Sys.ShmUnlink(mapName));
233
Interop
.CheckIo(
Interop
.Sys.FTruncate(fd, capacity));
237
Interop
.Sys.Fcntl.SetFD(fd, 0) == -1)
239
throw
Interop
.GetExceptionForIoErrno(
Interop
.Sys.GetLastErrorInfo());
274
Interop
.Sys.MemoryMappedProtections protections, long capacity, HandleInheritability inheritability)
276
int isReadonly = ((protections &
Interop
.Sys.MemoryMappedProtections.PROT_READ) != 0 &&
277
(protections &
Interop
.Sys.MemoryMappedProtections.PROT_WRITE) == 0) ? 1 : 0;
279
SafeFileHandle fd =
Interop
.Sys.MemfdCreate(GenerateMapName(), isReadonly);
282
Interop
.ErrorInfo errorInfo =
Interop
.Sys.GetLastErrorInfo();
285
throw
Interop
.GetExceptionForIoErrno(errorInfo);
294
Interop
.CheckIo(
Interop
.Sys.FTruncate(fd, capacity));
298
Interop
.Sys.Fcntl.SetFD(fd, 0) == -1)
300
throw
Interop
.GetExceptionForIoErrno(
Interop
.Sys.GetLastErrorInfo());
312
private static SafeFileHandle CreateSharedBackingObjectUsingFile(
Interop
.Sys.MemoryMappedProtections protections, long capacity, HandleInheritability inheritability)
327
Interop
.CheckIo(
Interop
.Sys.Unlink(path));
328
Interop
.CheckIo(
Interop
.Sys.FTruncate(fileHandle, capacity), path);
System\IO\MemoryMappedFiles\MemoryMappedView.Unix.cs (34)
38
long pageSize =
Interop
.Sys.SysConf(
Interop
.Sys.SysConfName._SC_PAGESIZE);
45
Interop
.Sys.MemoryMappedFlags flags =
47
Interop
.Sys.MemoryMappedFlags.MAP_PRIVATE :
48
Interop
.Sys.MemoryMappedFlags.MAP_SHARED;
62
flags |=
Interop
.Sys.MemoryMappedFlags.MAP_ANONYMOUS;
69
Interop
.Sys.MemoryMappedProtections viewProtForVerification = GetProtections(access, forVerification: true);
70
Interop
.Sys.MemoryMappedProtections mapProtForVerification = GetProtections(memMappedFileHandle._access, forVerification: true);
77
Interop
.Sys.MemoryMappedProtections viewProtForCreation = GetProtections(access, forVerification: false);
83
addr =
Interop
.Sys.MMap(
98
addr =
Interop
.Sys.MMap(
102
flags |
Interop
.Sys.MemoryMappedFlags.MAP_ANONYMOUS,
110
throw
Interop
.GetExceptionForIoErrno(
Interop
.Sys.GetLastErrorInfo());
139
int result =
Interop
.Sys.MSync(
141
Interop
.Sys.MemoryMappedSyncFlags.MS_SYNC |
Interop
.Sys.MemoryMappedSyncFlags.MS_INVALIDATE);
144
throw
Interop
.GetExceptionForIoErrno(
Interop
.Sys.GetLastErrorInfo());
163
Interop
.Sys.MAdvise(addr, length,
Interop
.Sys.MemoryAdvice.MADV_DONTFORK);
175
internal static
Interop
.Sys.MemoryMappedProtections GetProtections(
182
return
Interop
.Sys.MemoryMappedProtections.PROT_READ;
185
return
Interop
.Sys.MemoryMappedProtections.PROT_WRITE;
189
Interop
.Sys.MemoryMappedProtections.PROT_READ |
190
Interop
.Sys.MemoryMappedProtections.PROT_WRITE;
194
Interop
.Sys.MemoryMappedProtections.PROT_READ |
195
Interop
.Sys.MemoryMappedProtections.PROT_EXEC;
199
Interop
.Sys.MemoryMappedProtections.PROT_READ |
200
Interop
.Sys.MemoryMappedProtections.PROT_WRITE |
201
Interop
.Sys.MemoryMappedProtections.PROT_EXEC;
205
Interop
.Sys.MemoryMappedProtections.PROT_READ :
206
Interop
.Sys.MemoryMappedProtections.PROT_READ |
Interop
.Sys.MemoryMappedProtections.PROT_WRITE;