LibraryImports.g.cs (69)
5621internal static partial int Access(string path, global::Interop.Sys.AccessMode mode)
5650static extern unsafe int __PInvoke(byte* __path_native, global::Interop.Sys.AccessMode __mode_native);
6191internal static partial bool FileSystemSupportsLocking(global::Microsoft.Win32.SafeHandles.SafeFileHandle fd, global::Interop.Sys.LockOperations lockOperation, bool accessWrite)
6222static extern unsafe int __PInvoke(nint __fd_native, global::Interop.Sys.LockOperations __lockOperation_native, int __accessWrite_native);
6231internal static partial int FLock(global::Microsoft.Win32.SafeHandles.SafeFileHandle fd, global::Interop.Sys.LockOperations operation)
6260static extern unsafe int __PInvoke(nint __fd_native, global::Interop.Sys.LockOperations __operation_native);
6269internal static partial int FLock(nint fd, global::Interop.Sys.LockOperations operation)
6283static extern unsafe int __PInvoke(nint __fd_native, global::Interop.Sys.LockOperations __operation_native);
6368internal static partial double GetCpuUtilization(ref global::Interop.Sys.ProcessCpuInformation previousCpuInfo)
6372fixed (global::Interop.Sys.ProcessCpuInformation* __previousCpuInfo_native = &previousCpuInfo)
6380static extern unsafe double __PInvoke(global::Interop.Sys.ProcessCpuInformation* __previousCpuInfo_native);
6389internal static unsafe partial int Pipe(int* pipefd, global::Interop.Sys.PipeFlags flags)
6403static extern unsafe int __PInvoke(int* __pipefd_native, global::Interop.Sys.PipeFlags __flags_native);
6797internal static partial int LockFileRegion(global::System.Runtime.InteropServices.SafeHandle fd, long offset, long length, global::Interop.Sys.LockType lockType)
6826static extern unsafe int __PInvoke(nint __fd_native, long __offset_native, long __length_native, global::Interop.Sys.LockType __lockType_native);
6921internal static partial long LSeek(global::Microsoft.Win32.SafeHandles.SafeFileHandle fd, long offset, global::Interop.Sys.SeekWhence whence)
6950static extern unsafe long __PInvoke(nint __fd_native, long __offset_native, global::Interop.Sys.SeekWhence __whence_native);
7099internal static partial nint MMap(nint addr, ulong len, global::Interop.Sys.MemoryMappedProtections prot, global::Interop.Sys.MemoryMappedFlags flags, global::Microsoft.Win32.SafeHandles.SafeFileHandle fd, long offset)
7128static extern unsafe nint __PInvoke(nint __addr_native, ulong __len_native, global::Interop.Sys.MemoryMappedProtections __prot_native, global::Interop.Sys.MemoryMappedFlags __flags_native, nint __fd_native, long __offset_native);
7137internal static partial nint MMap(nint addr, ulong len, global::Interop.Sys.MemoryMappedProtections prot, global::Interop.Sys.MemoryMappedFlags flags, nint fd, long offset)
7151static extern unsafe nint __PInvoke(nint __addr_native, ulong __len_native, global::Interop.Sys.MemoryMappedProtections __prot_native, global::Interop.Sys.MemoryMappedFlags __flags_native, nint __fd_native, long __offset_native);
7191internal static partial global::Microsoft.Win32.SafeHandles.SafeFileHandle Open(string filename, global::Interop.Sys.OpenFlags flags, int mode)
7235static extern unsafe nint __PInvoke(byte* __filename_native, global::Interop.Sys.OpenFlags __flags_native, int __mode_native);
7244private static partial int PathConf(string path, global::Interop.Sys.PathConfName name)
7273static extern unsafe int __PInvoke(byte* __path_native, global::Interop.Sys.PathConfName __name_native);
7282internal static partial int PosixFAdvise(global::Microsoft.Win32.SafeHandles.SafeFileHandle fd, long offset, long length, global::Interop.Sys.FileAdvice advice)
7307static extern unsafe int __PInvoke(nint __fd_native, long __offset_native, long __length_native, global::Interop.Sys.FileAdvice __advice_native);
7392internal static unsafe partial long ReadV(global::System.Runtime.InteropServices.SafeHandle fd, global::Interop.Sys.IOVector* vectors, int vectorCount)
7421static extern unsafe long __PInvoke(nint __fd_native, global::Interop.Sys.IOVector* __vectors_native, int __vectorCount_native);
7430internal static unsafe partial long PReadV(global::System.Runtime.InteropServices.SafeHandle fd, global::Interop.Sys.IOVector* vectors, int vectorCount, long fileOffset)
7459static extern unsafe long __PInvoke(nint __fd_native, global::Interop.Sys.IOVector* __vectors_native, int __vectorCount_native, long __fileOffset_native);
7506internal static unsafe partial long PWriteV(global::System.Runtime.InteropServices.SafeHandle fd, global::Interop.Sys.IOVector* vectors, int vectorCount, long fileOffset)
7535static extern unsafe long __PInvoke(nint __fd_native, global::Interop.Sys.IOVector* __vectors_native, int __vectorCount_native, long __fileOffset_native);
7620internal static unsafe partial long WriteV(global::System.Runtime.InteropServices.SafeHandle fd, global::Interop.Sys.IOVector* vectors, int vectorCount)
7649static extern unsafe long __PInvoke(nint __fd_native, global::Interop.Sys.IOVector* __vectors_native, int __vectorCount_native);
7696internal static unsafe extern partial int ReadDir(nint dir, global::Interop.Sys.DirectoryEntry* outputEntry);
7856internal static partial int FStat(global::System.Runtime.InteropServices.SafeHandle fd, out global::Interop.Sys.FileStatus output)
7869fixed (global::Interop.Sys.FileStatus* __output_native = &output)
7888static extern unsafe int __PInvoke(nint __fd_native, global::Interop.Sys.FileStatus* __output_native);
7897internal static partial int Stat(string path, out global::Interop.Sys.FileStatus output)
7910fixed (global::Interop.Sys.FileStatus* __output_native = &output)
7929static extern unsafe int __PInvoke(byte* __path_native, global::Interop.Sys.FileStatus* __output_native);
7938internal static partial int LStat(string path, out global::Interop.Sys.FileStatus output)
7951fixed (global::Interop.Sys.FileStatus* __output_native = &output)
7970static extern unsafe int __PInvoke(byte* __path_native, global::Interop.Sys.FileStatus* __output_native);
7979internal static partial int Stat(global::System.ReadOnlySpan<char> path, out global::Interop.Sys.FileStatus output)
7992fixed (global::Interop.Sys.FileStatus* __output_native = &output)
8011static extern unsafe int __PInvoke(byte* __path_native, global::Interop.Sys.FileStatus* __output_native);
8020internal static partial int LStat(global::System.ReadOnlySpan<char> path, out global::Interop.Sys.FileStatus output)
8033fixed (global::Interop.Sys.FileStatus* __output_native = &output)
8052static extern unsafe int __PInvoke(byte* __path_native, global::Interop.Sys.FileStatus* __output_native);
8104internal static partial long SysConf(global::Interop.Sys.SysConfName name)
8118static extern unsafe long __PInvoke(global::Interop.Sys.SysConfName __name_native);
8127internal static partial void SysLog(global::Interop.Sys.SysLogPriority priority, string message, string arg1)
8155static extern unsafe void __PInvoke(global::Interop.Sys.SysLogPriority __priority_native, byte* __message_native, byte* __arg1_native);
8232internal static unsafe partial int UTimensat(string path, global::Interop.Sys.TimeSpec* times)
8261static extern unsafe int __PInvoke(byte* __path_native, global::Interop.Sys.TimeSpec* __times_native);
8270internal static unsafe partial int FUTimens(global::System.Runtime.InteropServices.SafeHandle fd, global::Interop.Sys.TimeSpec* times)
8299static extern unsafe int __PInvoke(nint __fd_native, global::Interop.Sys.TimeSpec* __times_native);
8446internal static unsafe partial int GetPwUidR(uint uid, out global::Interop.Sys.Passwd pwd, byte* buf, int bufLen)
8451fixed (global::Interop.Sys.Passwd* __pwd_native = &pwd)
8459static extern unsafe int __PInvoke(uint __uid_native, global::Interop.Sys.Passwd* __pwd_native, byte* __buf_native, int __bufLen_native);
8468internal static unsafe partial int GetPwNamR(string name, out global::Interop.Sys.Passwd pwd, byte* buf, int bufLen)
8480fixed (global::Interop.Sys.Passwd* __pwd_native = &pwd)
8496static extern unsafe int __PInvoke(byte* __name_native, global::Interop.Sys.Passwd* __pwd_native, byte* __buf_native, int __bufLen_native);
src\libraries\System.Private.CoreLib\src\Microsoft\Win32\SafeHandles\SafeFileHandle.Unix.cs (84)
64if (Interop.Sys.Fcntl.GetIsNonBlocking(this, out bool isNonBlocking) != 0)
66throw Interop.GetExceptionForIoErrno(Interop.Sys.GetLastErrorInfo(), Path);
110private static SafeFileHandle Open(string path, Interop.Sys.OpenFlags flags, int mode, bool failForSymlink, out bool wasSymlink,
111Func<Interop.ErrorInfo, Interop.Sys.OpenFlags, string, Exception?>? createOpenException)
115SafeFileHandle handle = Interop.Sys.Open(path, flags, mode);
120Interop.ErrorInfo error = Interop.Sys.GetLastErrorInfo();
156Interop.Sys.Unlink(_path); // ignore errors; it's valid that the path may no longer exist
166Interop.Sys.FLock(handle, Interop.Sys.LockOperations.LOCK_UN); // ignore any errors
171return Interop.Sys.Close(handle) == 0;
189Interop.Sys.PipeFlags flags = Interop.Sys.PipeFlags.O_CLOEXEC;
192flags |= Interop.Sys.PipeFlags.O_NONBLOCK_READ;
197flags |= Interop.Sys.PipeFlags.O_NONBLOCK_WRITE;
204if (Interop.Sys.Pipe(fds, flags) != 0)
206Interop.ErrorInfo error = Interop.Sys.GetLastErrorInfo();
212readFd = fds[Interop.Sys.ReadEndOfPipe];
213writeFd = fds[Interop.Sys.WriteEndOfPipe];
236Func<Interop.ErrorInfo, Interop.Sys.OpenFlags, string, Exception?>? createOpenException = null)
242Func<Interop.ErrorInfo, Interop.Sys.OpenFlags, string, Exception?>? createOpenException = null)
249Func<Interop.ErrorInfo, Interop.Sys.OpenFlags, string, Exception?>? createOpenException = null)
252Interop.Sys.OpenFlags openFlags = PreOpenConfigurationFromOptions(mode, access, share, options, failForSymlink);
295private static Interop.Sys.OpenFlags PreOpenConfigurationFromOptions(FileMode mode, FileAccess access, FileShare share, FileOptions options, bool failForSymlink)
298Interop.Sys.OpenFlags flags = default;
301flags |= Interop.Sys.OpenFlags.O_NOFOLLOW;
313flags |= Interop.Sys.OpenFlags.O_TRUNC;
319flags |= Interop.Sys.OpenFlags.O_CREAT;
323flags |= Interop.Sys.OpenFlags.O_CREAT;
326flags |= Interop.Sys.OpenFlags.O_TRUNC;
331flags |= (Interop.Sys.OpenFlags.O_CREAT | Interop.Sys.OpenFlags.O_EXCL);
339flags |= Interop.Sys.OpenFlags.O_RDONLY;
343flags |= Interop.Sys.OpenFlags.O_RDWR;
347flags |= Interop.Sys.OpenFlags.O_WRONLY;
354flags |= Interop.Sys.OpenFlags.O_CLOEXEC;
366flags |= Interop.Sys.OpenFlags.O_SYNC;
375Interop.Sys.FileStatus status = default;
387if ((status.Mode & Interop.Sys.FileTypes.S_IFMT) == Interop.Sys.FileTypes.S_IFDIR)
392if ((status.Mode & Interop.Sys.FileTypes.S_IFMT) == Interop.Sys.FileTypes.S_IFREG)
401Debug.Assert(status.Size == 0 || Interop.Sys.LSeek(this, 0, Interop.Sys.SeekWhence.SEEK_CUR) >= 0);
416Interop.Sys.LockOperations lockOperation = (share == FileShare.None) ? Interop.Sys.LockOperations.LOCK_EX : Interop.Sys.LockOperations.LOCK_SH;
417if (CanLockTheFile(lockOperation, access) && !(_isLocked = Interop.Sys.FLock(this, lockOperation | Interop.Sys.LockOperations.LOCK_NB) >= 0))
423Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo();
443Interop.Sys.FileStatus pathStatus;
444if (Interop.Sys.Stat(path, out pathStatus) < 0)
449Interop.ErrorInfo error = Interop.Sys.GetLastErrorInfo();
471Interop.Sys.FileAdvice fadv =
472(options & FileOptions.RandomAccess) != 0 ? Interop.Sys.FileAdvice.POSIX_FADV_RANDOM :
473(options & FileOptions.SequentialScan) != 0 ? Interop.Sys.FileAdvice.POSIX_FADV_SEQUENTIAL :
477FileStreamHelpers.CheckFileCall(Interop.Sys.PosixFAdvise(this, 0, 0, fadv), path,
485if (Interop.Sys.FTruncate(this, 0) < 0)
487Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo();
498if (preallocationSize > 0 && Interop.Sys.FAllocate(this, 0, preallocationSize) < 0)
500Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo();
510Interop.Sys.Unlink(path);
522private bool CanLockTheFile(Interop.Sys.LockOperations lockOperation, FileAccess access)
524Debug.Assert(lockOperation == Interop.Sys.LockOperations.LOCK_EX || lockOperation == Interop.Sys.LockOperations.LOCK_SH);
531return Interop.Sys.FileSystemSupportsLocking(this, lockOperation, accessWrite: (access & FileAccess.Write) != 0);
534private void FStatCheckIO(string path, ref Interop.Sys.FileStatus status, ref bool statusHasValue)
538if (Interop.Sys.FStat(this, out status) != 0)
540Interop.ErrorInfo error = Interop.Sys.GetLastErrorInfo();
556_canSeek = canSeek = Interop.Sys.LSeek(this, 0, Interop.Sys.SeekWhence.SEEK_CUR) >= 0 ? NullableBool.True : NullableBool.False;
564int result = Interop.Sys.FStat(this, out Interop.Sys.FileStatus status);
567Interop.ErrorInfo error = Interop.Sys.GetLastErrorInfo();
574private static FileHandleType MapUnixFileTypeToFileType(Interop.Sys.FileStatus status)
575=> (status.Mode & Interop.Sys.FileTypes.S_IFMT) switch
577Interop.Sys.FileTypes.S_IFREG => FileHandleType.RegularFile,
578Interop.Sys.FileTypes.S_IFDIR => FileHandleType.Directory,
579Interop.Sys.FileTypes.S_IFLNK => FileHandleType.SymbolicLink,
580Interop.Sys.FileTypes.S_IFIFO => FileHandleType.Pipe,
581Interop.Sys.FileTypes.S_IFSOCK => FileHandleType.Socket,
582Interop.Sys.FileTypes.S_IFCHR => FileHandleType.CharacterDevice,
583Interop.Sys.FileTypes.S_IFBLK => FileHandleType.BlockDevice,
589int result = Interop.Sys.FStat(this, out Interop.Sys.FileStatus status);
src\libraries\System.Private.CoreLib\src\System\IO\FileStatus.Unix.cs (34)
29private Interop.Sys.FileStatus _fileCache;
44return EntryExists && (_fileCache.UserFlags & (uint)Interop.Sys.UserFlags.UF_HIDDEN) == (uint)Interop.Sys.UserFlags.UF_HIDDEN;
106if (_fileCache.Uid == Interop.Sys.GetEUid())
118if (Interop.Sys.IsMemberOfGroup(_fileCache.Gid))
138return EntryExists && (_fileCache.Mode & Interop.Sys.FileTypes.S_IFMT) == Interop.Sys.FileTypes.S_IFLNK;
162if (!Interop.Sys.SupportsHiddenFlag)
246if (Interop.Sys.CanSetHiddenFlag)
251uint flags = hidden ? _fileCache.UserFlags | (uint)Interop.Sys.UserFlags.UF_HIDDEN :
252_fileCache.UserFlags & ~(uint)Interop.Sys.UserFlags.UF_HIDDEN;
253int rv = handle is not null ? Interop.Sys.FChflags(handle, flags) :
254Interop.Sys.LChflags(path!, flags);
277int rv = handle is not null ? Interop.Sys.FChMod(handle, newMode) :
278Interop.Sys.ChMod(path!, newMode);
304if ((_fileCache.Flags & Interop.Sys.FileStatusFlags.HasBirthTime) != 0)
392Interop.Sys.TimeSpec* buf = stackalloc Interop.Sys.TimeSpec[2];
419? Interop.Sys.FUTimens(handle, buf)
420: Interop.Sys.UTimensat(path!, buf);
431bool updateCreationTime = checkCreationTime && (_fileCache.Flags & Interop.Sys.FileStatusFlags.HasBirthTime) != 0 &&
486int rv = handle is not null ? Interop.Sys.FChMod(handle, (int)mode)
487: Interop.Sys.ChMod(path!, (int)mode);
506Interop.Sys.FStat(handle, out _fileCache) :
507Interop.Sys.LStat(Path.TrimEndingDirectorySeparator(path), out _fileCache);
511Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo();
531int fileType = _fileCache.Mode & Interop.Sys.FileTypes.S_IFMT;
532bool isDirectory = fileType == Interop.Sys.FileTypes.S_IFDIR;
534if (fileType == Interop.Sys.FileTypes.S_IFLNK)
536if (Interop.Sys.Stat(path, out Interop.Sys.FileStatus target) == 0)
538isDirectory = (target.Mode & Interop.Sys.FileTypes.S_IFMT) == Interop.Sys.FileTypes.S_IFDIR;
541_fileCache.Mode = Interop.Sys.FileTypes.S_IFLNK | (target.Mode & (int)FileSystem.ValidUnixFileModes);
src\libraries\System.Private.CoreLib\src\System\IO\FileSystem.Unix.cs (47)
51Interop.CheckIo(Interop.Sys.CopyFile(src, dst, fileLength));
54private static Exception? CreateOpenExceptionForCopyFile(Interop.ErrorInfo error, Interop.Sys.OpenFlags flags, string path)
77if (Interop.Sys.Link(sourceFullPath, destFullPath) >= 0)
87Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo();
126Interop.CheckIo(Interop.Sys.LStat(sourceFullPath, out Interop.Sys.FileStatus sourceStat), sourceFullPath);
129if ((sourceStat.Mode & Interop.Sys.FileTypes.S_IFMT) == Interop.Sys.FileTypes.S_IFDIR)
134Interop.Sys.FileStatus destStat;
135if (Interop.Sys.LStat(destFullPath, out destStat) == 0)
138if ((destStat.Mode & Interop.Sys.FileTypes.S_IFMT) == Interop.Sys.FileTypes.S_IFDIR)
154if (Interop.Sys.Unlink(destBackupFullPath) != 0)
156Interop.ErrorInfo errno = Interop.Sys.GetLastErrorInfo();
170if (Interop.Sys.Stat(destFullPath, out _) != 0)
172Interop.ErrorInfo errno = Interop.Sys.GetLastErrorInfo();
181Interop.CheckIo(Interop.Sys.Rename(sourceFullPath, destFullPath));
195if (Interop.Sys.Rename(sourceFullPath, destFullPath) < 0)
197Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo();
224Interop.Sys.FileStatus sourceStat, destStat;
225if (Interop.Sys.LStat(sourceFullPath, out sourceStat) == 0 && // source file exists
226(Interop.Sys.LStat(destFullPath, out destStat) != 0 || // dest file does not exist
229Interop.Sys.Rename(sourceFullPath, destFullPath) == 0) // try the rename
241if (Interop.Sys.Unlink(fullPath) < 0)
243Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo();
296int result = Interop.Sys.MkDir(path, (int)unixCreateMode);
302Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo();
340int result = Interop.Sys.MkDir(mkdirPath, (int)DefaultUnixCreateDirectoryMode);
346Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo();
373int result = Interop.Sys.MkDir(mkdirPath, (int)mode);
376Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo();
414if (!isCaseSensitiveRename && Interop.Sys.LStat(destNoDirectorySeparator, out Interop.Sys.FileStatus destFileStatus) >= 0)
419if (Interop.Sys.LStat(srcNoDirectorySeparator, out Interop.Sys.FileStatus sourceFileStatus) < 0)
438else if ((sourceFileStatus.Mode & Interop.Sys.FileTypes.S_IFMT) != Interop.Sys.FileTypes.S_IFDIR
449if (Interop.Sys.Rename(sourceFullPath, destNoDirectorySeparator) < 0)
451Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo();
527if (Interop.Sys.RmDir(fullPath) < 0)
529Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo();
662internal static string? GetLinkTarget(ReadOnlySpan<char> linkPath, bool isDirectory) => Interop.Sys.ReadLink(linkPath);
666Interop.CheckIo(Interop.Sys.SymLink(pathToTarget, path), path);
672Interop.CheckIo(Interop.Sys.Link(pathToTarget, path), path);
680string? linkTarget = Interop.Sys.ReadLink(linkPath);
683Interop.Error error = Interop.Sys.GetLastError();
713current = Interop.Sys.ReadLink(sb.AsSpan());
src\libraries\System.Private.CoreLib\src\System\IO\RandomAccess.Unix.cs (28)
23FileStreamHelpers.CheckFileCall(Interop.Sys.FTruncate(handle, length), handle.Path);
35result = Interop.Sys.ReadFromNonblocking(handle, bufPtr, buffer.Length);
40result = Interop.Sys.PRead(handle, bufPtr, buffer.Length, fileOffset);
42if (result == -1 && ShouldFallBackToNonOffsetSyscall(Interop.Sys.GetLastErrorInfo()))
50result = Interop.Sys.Read(handle, bufPtr, buffer.Length);
61Span<Interop.Sys.IOVector> vectors = buffers.Count <= IovStackThreshold ? stackalloc Interop.Sys.IOVector[IovStackThreshold] : new Interop.Sys.IOVector[buffers.Count];
71vectors[i] = new Interop.Sys.IOVector { Base = (byte*)memoryHandle.Pointer, Count = (UIntPtr)buffer.Length };
75fixed (Interop.Sys.IOVector* pinnedVectors = &MemoryMarshal.GetReference(vectors))
79result = Interop.Sys.PReadV(handle, pinnedVectors, buffers.Count, fileOffset);
81if (result == -1 && ShouldFallBackToNonOffsetSyscall(Interop.Sys.GetLastErrorInfo()))
89result = Interop.Sys.ReadV(handle, pinnedVectors, buffers.Count);
123bytesWritten = Interop.Sys.WriteToNonblocking(handle, bufPtr, bytesToWrite);
127bytesWritten = Interop.Sys.PWrite(handle, bufPtr, bytesToWrite, fileOffset);
129if (bytesWritten == -1 && ShouldFallBackToNonOffsetSyscall(Interop.Sys.GetLastErrorInfo()))
137bytesWritten = Interop.Sys.Write(handle, bufPtr, bytesToWrite);
177Span<Interop.Sys.IOVector> vectors = buffersCount <= IovStackThreshold ?
178stackalloc Interop.Sys.IOVector[IovStackThreshold].Slice(0, buffersCount) :
179new Interop.Sys.IOVector[buffersCount];
190vectors[i] = new Interop.Sys.IOVector { Base = (byte*)memoryHandle.Pointer, Count = (UIntPtr)buffer.Length };
198Span<Interop.Sys.IOVector> left = vectors.Slice(buffersOffset);
199fixed (Interop.Sys.IOVector* pinnedVectors = &MemoryMarshal.GetReference(left))
203bytesWritten = Interop.Sys.PWriteV(handle, pinnedVectors, left.Length, fileOffset);
205if (bytesWritten == -1 && ShouldFallBackToNonOffsetSyscall(Interop.Sys.GetLastErrorInfo()))
213bytesWritten = Interop.Sys.WriteV(handle, pinnedVectors, left.Length);
243Interop.Sys.IOVector current = vectors[buffersOffset];
244vectors[buffersOffset] = new Interop.Sys.IOVector
src\libraries\System.Private.CoreLib\src\System\IO\SharedMemoryManager.Unix.cs (61)
24private static int SessionId { get; } = Interop.Sys.GetSid(Environment.ProcessId);
50Uid = IsUserScope ? Interop.Sys.GetEUid() : 0;
211Interop.Sys.FLock(fileHandle, Interop.Sys.LockOperations.LOCK_UN);
223if (Interop.Sys.FTruncate(fileHandle, (long)sharedDataTotalByteCount) < 0)
225Interop.ErrorInfo error = Interop.Sys.GetLastErrorInfo();
231if (Interop.Sys.FStat(fileHandle, out Interop.Sys.FileStatus fileStatus) != 0)
233Interop.ErrorInfo error = Interop.Sys.GetLastErrorInfo();
242if (Interop.Sys.FTruncate(fileHandle, (long)sharedDataTotalByteCount) < 0)
244Interop.ErrorInfo error = Interop.Sys.GetLastErrorInfo();
256Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo();
341Interop.Sys.FLock(_fileHandle, Interop.Sys.LockOperations.LOCK_UN);
356Interop.Sys.MUnmap((nint)_sharedDataHeader, _sharedDataTotalByteCount);
372Interop.Sys.Unlink(sharedMemoryFilePath);
374Interop.Sys.RmDir(sessionDirectoryPath);
423SafeFileHandle fd = Interop.Sys.Open(sharedMemoryFilePath, Interop.Sys.OpenFlags.O_RDWR | Interop.Sys.OpenFlags.O_CLOEXEC, 0);
424Interop.ErrorInfo error = Interop.Sys.GetLastErrorInfo();
429if (Interop.Sys.FStat(fd, out Interop.Sys.FileStatus fileStatus) != 0)
431error = Interop.Sys.GetLastErrorInfo();
469fd = Interop.Sys.Open(
471Interop.Sys.OpenFlags.O_RDWR | Interop.Sys.OpenFlags.O_CLOEXEC | Interop.Sys.OpenFlags.O_CREAT | Interop.Sys.OpenFlags.O_EXCL,
476error = Interop.Sys.GetLastErrorInfo();
480int result = Interop.Sys.FChMod(fd, (int)permissionsMask);
484error = Interop.Sys.GetLastErrorInfo();
486Interop.Sys.Unlink(sharedMemoryFilePath);
500int statResult = Interop.Sys.Stat(directoryPath, out Interop.Sys.FileStatus fileStatus);
502if (statResult != 0 && Interop.Sys.GetLastError() == Interop.Error.ENOENT)
541if (Interop.Sys.MkdTemp(tempPathPtr) == null)
544Interop.ErrorInfo error = Interop.Sys.GetLastErrorInfo();
562if (Interop.Sys.Rename(tempPath, directoryPath) == 0)
570statResult = Interop.Sys.Stat(directoryPath, out fileStatus);
574if (statResult != 0 || (fileStatus.Mode & Interop.Sys.FileTypes.S_IFDIR) == 0)
578Interop.ErrorInfo error = Interop.Sys.GetLastErrorInfo();
628|| (createIfNotExist && Interop.Sys.ChMod(directoryPath, (int)permissionsMask) == 0))
653nint addr = Interop.Sys.MMap(
656Interop.Sys.MemoryMappedProtections.PROT_READ | Interop.Sys.MemoryMappedProtections.PROT_WRITE,
657Interop.Sys.MemoryMappedFlags.MAP_SHARED,
663Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo();
672Interop.Sys.LockOperations lockOperation = exclusive ? Interop.Sys.LockOperations.LOCK_EX : Interop.Sys.LockOperations.LOCK_SH;
675lockOperation |= Interop.Sys.LockOperations.LOCK_NB;
677int result = Interop.Sys.FLock(sharedLockFileHandle, lockOperation);
684Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo();
707Interop.Sys.MUnmap(addr, length);
730Interop.Sys.FLock(FileHandle, Interop.Sys.LockOperations.LOCK_UN);
764Interop.ErrorInfo error = Interop.Sys.GetLastErrorInfo();
779fd = Interop.Sys.Open(sharedMemoryDirectory, Interop.Sys.OpenFlags.O_RDONLY, 0);
782Interop.ErrorInfo error = Interop.Sys.GetLastErrorInfo();
src\libraries\System.Private.CoreLib\src\System\IO\Strategies\FileStreamHelpers.Unix.cs (10)
23Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo();
34CheckFileCall(Interop.Sys.LSeek(handle, offset, (Interop.Sys.SeekWhence)(int)origin), handle.Path); // SeekOrigin values are the same as Interop.libc.SeekWhence values
42if (Interop.Sys.FSync(handle) < 0)
44Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo();
66CheckFileCall(Interop.Sys.LockFileRegion(handle, position, length, canWrite ? Interop.Sys.LockType.F_WRLCK : Interop.Sys.LockType.F_RDLCK), handle.Path);
76CheckFileCall(Interop.Sys.LockFileRegion(handle, position, length, Interop.Sys.LockType.F_UNLCK), handle.Path);