783 references to Interop
System.Private.CoreLib (783)
src\libraries\Common\src\Interop\Unix\Interop.Errors.cs (6)
123_error = Interop.Sys.ConvertErrorPlatformToPal(errno); 140get { return _rawErrno == -1 ? (_rawErrno = Interop.Sys.ConvertErrorPalToPlatform(_error)) : _rawErrno; } 145return Interop.Sys.StrError(RawErrno); 219public static Interop.ErrorInfo Info(this Interop.Error error) 221return new Interop.ErrorInfo(error);
src\libraries\Common\src\Interop\Unix\Interop.IOErrors.cs (4)
16throw Interop.GetExceptionForIoErrno(errorInfo, path, isDirError); 21if (error != Interop.Error.SUCCESS) 99Exception e = Interop.GetExceptionForIoErrno(Sys.GetLastErrorInfo(), path, isDirError); 179internal static Exception GetIOException(Interop.ErrorInfo errorInfo, string? path = null)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.DynamicLoad.cs (5)
11[LibraryImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_LoadLibrary", StringMarshalling = StringMarshalling.Utf8)] 14[LibraryImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetLoadLibraryError")] 17[LibraryImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetProcAddress")] 20[LibraryImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetProcAddress", StringMarshalling = StringMarshalling.Utf8)] 23[LibraryImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_FreeLibrary")]
src\libraries\Common\src\Interop\Unix\System.Native\Interop.ErrNo.cs (2)
11[LibraryImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetErrNo")] 15[LibraryImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_SetErrNo")]
src\libraries\Common\src\Interop\Unix\System.Native\Interop.GetCwd.cs (3)
62ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); 63if (errorInfo.Error == Interop.Error.ERANGE) 67throw Interop.GetExceptionForIoErrno(errorInfo);
src\libraries\Common\src\Interop\Unix\System.Native\Interop.GetEnv.cs (1)
11[LibraryImport(Interop.Libraries.SystemNative, StringMarshalling = StringMarshalling.Utf8, EntryPoint = "SystemNative_GetEnv")]
src\libraries\Common\src\Interop\Unix\System.Native\Interop.GetEnviron.cs (2)
11[LibraryImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetEnviron")] 14[LibraryImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_FreeEnviron")]
src\libraries\Common\src\Interop\Unix\System.Native\Interop.GetPwUid.cs (5)
36const int BufLen = Interop.Sys.Passwd.InitialBufferSize; 63Interop.Sys.Passwd passwd; 64int error = Interop.Sys.GetPwUidR(uid, out passwd, buf, bufLen); 82var errorInfo = new Interop.ErrorInfo(error); 86if (errorInfo.Error == Interop.Error.ERANGE)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.GetRandomBytes.cs (2)
11[LibraryImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetNonCryptographicallySecureRandomBytes")] 14[LibraryImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetCryptographicallySecureRandomBytes")]
src\libraries\Common\src\Interop\Unix\System.Native\Interop.GetSystemTimeAsTicks.cs (1)
10[LibraryImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetSystemTimeAsTicks")]
src\libraries\Common\src\Interop\Unix\System.Native\Interop.IsMemberOfGroup.cs (3)
30rv = Interop.Sys.GetGroups(groups.Length, pGroups); 38else if (rv == -1 && Interop.Sys.GetLastError() == Interop.Error.EINVAL)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.MemAlloc.cs (7)
11[LibraryImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_AlignedAlloc")] 14[LibraryImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_AlignedFree")] 17[LibraryImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_AlignedRealloc")] 20[LibraryImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_Calloc")] 23[LibraryImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_Free")] 26[LibraryImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_Malloc")] 29[LibraryImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_Realloc")]
src\libraries\Common\src\Interop\Unix\System.Native\Interop.SchedGetCpu.cs (1)
11[LibraryImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_SchedGetCpu")]
src\libraries\Common\src\System\IO\Win32Marshal.cs (11)
29Debug.Assert(errorCode != Interop.Errors.ERROR_SUCCESS); 33case Interop.Errors.ERROR_FILE_NOT_FOUND: 36case Interop.Errors.ERROR_PATH_NOT_FOUND: 39case Interop.Errors.ERROR_ACCESS_DENIED: 42case Interop.Errors.ERROR_ALREADY_EXISTS: 46case Interop.Errors.ERROR_FILENAME_EXCED_RANGE: 49case Interop.Errors.ERROR_SHARING_VIOLATION: 53case Interop.Errors.ERROR_FILE_EXISTS: 57case Interop.Errors.ERROR_OPERATION_ABORTED: 59case Interop.Errors.ERROR_INVALID_PARAMETER: 82return Interop.Kernel32.GetMessage(errorCode);
src\libraries\System.Private.CoreLib\src\Internal\Console.Unix.cs (2)
16Interop.Sys.Log(pBytes, bytes.Length); 27Interop.Sys.LogError(pBytes, bytes.Length);
src\libraries\System.Private.CoreLib\src\Microsoft\Win32\SafeHandles\SafeFileHandle.Unix.cs (97)
91private static SafeFileHandle Open(string path, Interop.Sys.OpenFlags flags, int mode, bool failForSymlink, out bool wasSymlink, 92Func<Interop.ErrorInfo, Interop.Sys.OpenFlags, string, Exception?>? createOpenException) 96SafeFileHandle handle = Interop.Sys.Open(path, flags, mode); 101Interop.ErrorInfo error = Interop.Sys.GetLastErrorInfo(); 104if (failForSymlink && error.Error == Interop.Error.ELOOP) 115if (error.Error == Interop.Error.EISDIR) 117error = Interop.Error.EACCES.Info(); 120Interop.CheckIo(error.Error, path); 128internal static Interop.ErrorInfo? t_lastCloseErrorInfo; 141Interop.Sys.Unlink(_path); // ignore errors; it's valid that the path may no longer exist 151Interop.Sys.FLock(handle, Interop.Sys.LockOperations.LOCK_UN); // ignore any errors 158int result = Interop.Sys.Close(handle); 161t_lastCloseErrorInfo = Interop.Sys.GetLastErrorInfo(); 185Func<Interop.ErrorInfo, Interop.Sys.OpenFlags, string, Exception?>? createOpenException = null) 191Func<Interop.ErrorInfo, Interop.Sys.OpenFlags, string, Exception?>? createOpenException = null) 198Func<Interop.ErrorInfo, Interop.Sys.OpenFlags, string, Exception?>? createOpenException = null) 201Interop.Sys.OpenFlags openFlags = PreOpenConfigurationFromOptions(mode, access, share, options, failForSymlink); 244private static Interop.Sys.OpenFlags PreOpenConfigurationFromOptions(FileMode mode, FileAccess access, FileShare share, FileOptions options, bool failForSymlink) 247Interop.Sys.OpenFlags flags = default; 250flags |= Interop.Sys.OpenFlags.O_NOFOLLOW; 262flags |= Interop.Sys.OpenFlags.O_TRUNC; 268flags |= Interop.Sys.OpenFlags.O_CREAT; 272flags |= Interop.Sys.OpenFlags.O_CREAT; 275flags |= Interop.Sys.OpenFlags.O_TRUNC; 280flags |= (Interop.Sys.OpenFlags.O_CREAT | Interop.Sys.OpenFlags.O_EXCL); 288flags |= Interop.Sys.OpenFlags.O_RDONLY; 292flags |= Interop.Sys.OpenFlags.O_RDWR; 296flags |= Interop.Sys.OpenFlags.O_WRONLY; 303flags |= Interop.Sys.OpenFlags.O_CLOEXEC; 315flags |= Interop.Sys.OpenFlags.O_SYNC; 324Interop.Sys.FileStatus status = default; 336if ((status.Mode & Interop.Sys.FileTypes.S_IFMT) == Interop.Sys.FileTypes.S_IFDIR) 338throw Interop.GetExceptionForIoErrno(Interop.Error.EACCES.Info(), path); 341if ((status.Mode & Interop.Sys.FileTypes.S_IFMT) == Interop.Sys.FileTypes.S_IFREG) 347Debug.Assert(Interop.Sys.LSeek(this, 0, Interop.Sys.SeekWhence.SEEK_CUR) >= 0); 359Interop.Sys.LockOperations lockOperation = (share == FileShare.None) ? Interop.Sys.LockOperations.LOCK_EX : Interop.Sys.LockOperations.LOCK_SH; 360if (CanLockTheFile(lockOperation, access) && !(_isLocked = Interop.Sys.FLock(this, lockOperation | Interop.Sys.LockOperations.LOCK_NB) >= 0)) 366Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); 367if (errorInfo.Error == Interop.Error.EWOULDBLOCK) 369throw Interop.GetExceptionForIoErrno(errorInfo, path); 386Interop.Sys.FileStatus pathStatus; 387if (Interop.Sys.Stat(path, out pathStatus) < 0) 392Interop.ErrorInfo error = Interop.Sys.GetLastErrorInfo(); 394if (error.Error == Interop.Error.ENOENT) 399throw Interop.GetExceptionForIoErrno(error, path); 414Interop.Sys.FileAdvice fadv = 415(options & FileOptions.RandomAccess) != 0 ? Interop.Sys.FileAdvice.POSIX_FADV_RANDOM : 416(options & FileOptions.SequentialScan) != 0 ? Interop.Sys.FileAdvice.POSIX_FADV_SEQUENTIAL : 420FileStreamHelpers.CheckFileCall(Interop.Sys.PosixFAdvise(this, 0, 0, fadv), path, 428if (Interop.Sys.FTruncate(this, 0) < 0) 430Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); 431if (errorInfo.Error != Interop.Error.EBADF && errorInfo.Error != Interop.Error.EINVAL) 436throw Interop.GetExceptionForIoErrno(errorInfo, path); 441if (preallocationSize > 0 && Interop.Sys.FAllocate(this, 0, preallocationSize) < 0) 443Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); 446if (errorInfo.Error == Interop.Error.EFBIG || 447errorInfo.Error == Interop.Error.ENOSPC) 453Interop.Sys.Unlink(path!); 455throw new IOException(SR.Format(errorInfo.Error == Interop.Error.EFBIG 465private bool CanLockTheFile(Interop.Sys.LockOperations lockOperation, FileAccess access) 467Debug.Assert(lockOperation == Interop.Sys.LockOperations.LOCK_EX || lockOperation == Interop.Sys.LockOperations.LOCK_SH); 473else if (lockOperation == Interop.Sys.LockOperations.LOCK_EX) 482if (!Interop.Sys.TryGetFileSystemType(this, out Interop.Sys.UnixFileSystemTypes unixFileSystemType)) 489case Interop.Sys.UnixFileSystemTypes.nfs: // #44546 490case Interop.Sys.UnixFileSystemTypes.smb: 491case Interop.Sys.UnixFileSystemTypes.smb2: // #53182 492case Interop.Sys.UnixFileSystemTypes.cifs: 499private void FStatCheckIO(string path, ref Interop.Sys.FileStatus status, ref bool statusHasValue) 503if (Interop.Sys.FStat(this, out status) != 0) 505Interop.ErrorInfo error = Interop.Sys.GetLastErrorInfo(); 506throw Interop.GetExceptionForIoErrno(error, path); 521_canSeek = canSeek = Interop.Sys.LSeek(this, 0, Interop.Sys.SeekWhence.SEEK_CUR) >= 0 ? NullableBool.True : NullableBool.False; 529int result = Interop.Sys.FStat(this, out Interop.Sys.FileStatus status);
src\libraries\System.Private.CoreLib\src\Microsoft\Win32\SafeHandles\SafeWaitHandle.Windows.cs (1)
8protected override bool ReleaseHandle() => Interop.Kernel32.CloseHandle(handle);
src\libraries\System.Private.CoreLib\src\System\AppDomain.Unix.cs (2)
12Interop.Sys.ProcessCpuInformation cpuInfo = default; 13Interop.Sys.GetCpuUtilization(ref cpuInfo);
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\RandomizedStringEqualityComparer.cs (1)
25Interop.GetRandomBytes((byte*)seed, sizeof(MarvinSeed));
src\libraries\System.Private.CoreLib\src\System\DateTime.Unix.cs (1)
14return new DateTime(((ulong)(Interop.Sys.GetSystemTimeAsTicks() + UnixEpochTicks)) | KindUtc);
src\libraries\System.Private.CoreLib\src\System\Diagnostics\DebugProvider.Unix.cs (3)
56Interop.Sys.SysLog(Interop.Sys.SysLogPriority.LOG_DEBUG, "%s", message); 89int bytesWritten = Interop.Sys.Write((IntPtr)2 /* stderr */, buf + totalBytesWritten, bufCount);
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Stopwatch.Unix.cs (1)
16return (long)Interop.Sys.GetTimestamp();
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventPipe.Internal.cs (1)
31delegate* unmanaged<byte*, int, byte, long, long, Interop.Advapi32.EVENT_FILTER_DESCRIPTOR*, void*, void> callbackFunc,
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventPipeEventProvider.cs (4)
26Interop.Advapi32.EVENT_FILTER_DESCRIPTOR* filterData) 63long matchAnyKeywords, long matchAllKeywords, Interop.Advapi32.EVENT_FILTER_DESCRIPTOR* filterData, void* callbackContext) 134internal override int ActivityIdControl(Interop.Advapi32.ActivityControl controlCode, ref Guid activityId) 147internal static int EventActivityIdControl(Interop.Advapi32.ActivityControl controlCode, ref Guid activityId)
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventProvider.cs (7)
1196Interop.Advapi32.EVENT_FILTER_DESCRIPTOR* filterData) 1281internal virtual int ActivityIdControl(Interop.Advapi32.ActivityControl ControlCode, ref Guid ActivityId) 1300Interop.Advapi32.EVENT_FILTER_DESCRIPTOR* filterData) 1307if (controlCode == Interop.Advapi32.EVENT_CONTROL_CODE_ENABLE_PROVIDER) 1315if (controlCode == Interop.Advapi32.EVENT_CONTROL_CODE_DISABLE_PROVIDER) 1319else if (controlCode == Interop.Advapi32.EVENT_CONTROL_CODE_CAPTURE_STATE) 1374protected unsafe bool MarshalFilterData(Interop.Advapi32.EVENT_FILTER_DESCRIPTOR* filterData, out ControllerCommand command, out byte[]? data)
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventSource.cs (3)
551Interop.Advapi32.ActivityControl.EVENT_ACTIVITY_CTRL_SET_ID, 583Interop.Advapi32.ActivityControl.EVENT_ACTIVITY_CTRL_GET_ID, 627Interop.Advapi32.ActivityControl.EVENT_ACTIVITY_CTRL_GET_SET_ID,
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\RuntimeEventSourceHelper.Unix.cs (2)
8private static Interop.Sys.ProcessCpuInformation s_cpuInfo; 11Interop.Sys.GetCpuUtilization(ref s_cpuInfo) / Environment.ProcessorCount;
src\libraries\System.Private.CoreLib\src\System\Environment.GetFolderPathCore.Unix.cs (4)
30Interop.Sys.Access(path, Interop.Sys.AccessMode.R_OK) == 0) 182if (Interop.Sys.Access(userDirsPath, Interop.Sys.AccessMode.R_OK) == 0)
src\libraries\System.Private.CoreLib\src\System\Environment.Linux.cs (2)
10public static long WorkingSet => (long)(Interop.procfs.TryReadStatusFile(ProcessId, out Interop.procfs.ParsedStatus status) ? status.VmRSS : 0);
src\libraries\System.Private.CoreLib\src\System\Environment.OSVersion.Unix.cs (1)
8private static OperatingSystem GetOSVersion() => GetOperatingSystem(Interop.Sys.GetUnixRelease());
src\libraries\System.Private.CoreLib\src\System\Environment.Unix.cs (7)
15public static string[] GetLogicalDrives() => Interop.Sys.GetAllMountPoints(); 21string hostName = Interop.Sys.GetHostName(); 27public static string UserName => Interop.Sys.GetUserNameFromPasswd(Interop.Sys.GetEUid()); 29private static bool IsPrivilegedProcessCore() => Interop.Sys.GetEUid() == 0; 32private static int GetProcessId() => Interop.Sys.GetPid(); 35private static string? GetProcessPath() => Interop.Sys.GetProcessPath();
src\libraries\System.Private.CoreLib\src\System\Environment.UnixOrBrowser.cs (11)
19get => Interop.Sys.GetCwd(); 20set => Interop.CheckIo(Interop.Sys.ChDir(value), value, isDirError: true); 55private static int GetSystemPageSize() => CheckedSysConf(Interop.Sys.SysConfName._SC_PAGESIZE); 59/// <summary>Invoke <see cref="Interop.Sys.SysConf"/>, throwing if it fails.</summary> 60private static int CheckedSysConf(Interop.Sys.SysConfName name) 62long result = Interop.Sys.SysConf(name); 65Interop.ErrorInfo errno = Interop.Sys.GetLastErrorInfo(); 66throw errno.Error == Interop.Error.EINVAL ? 68Interop.GetIOException(errno);
src\libraries\System.Private.CoreLib\src\System\Environment.Variables.Windows.cs (12)
18while ((length = Interop.Kernel32.GetEnvironmentVariable(variable, ref builder.GetPinnableReference(), (uint)builder.Capacity)) > builder.Capacity) 23if (length == 0 && Marshal.GetLastPInvokeError() == Interop.Errors.ERROR_ENVVAR_NOT_FOUND) 37uint length = Interop.Kernel32.GetEnvironmentVariable(variable, ref MemoryMarshal.GetReference(span), (uint)span.Length); 45if (!Interop.Kernel32.SetEnvironmentVariable(variable, value)) 50case Interop.Errors.ERROR_ENVVAR_NOT_FOUND: 54case Interop.Errors.ERROR_FILENAME_EXCED_RANGE: 59case Interop.Errors.ERROR_NOT_ENOUGH_MEMORY: 60case Interop.Errors.ERROR_NO_SYSTEM_RESOURCES: 84char* stringPtr = Interop.Kernel32.GetEnvironmentStringsW(); 129Interop.BOOL success = Interop.Kernel32.FreeEnvironmentStringsW(stringPtr); 130Debug.Assert(success != Interop.BOOL.FALSE);
src\libraries\System.Private.CoreLib\src\System\Globalization\CalendarData.Icu.cs (4)
99count = Interop.Globalization.GetCalendars(localeName, calendars, calendars.Length); 124return Interop.CallStringMethod( 129return Interop.Globalization.GetCalendarInfo(locale, id, type, bufferPtr, buffer.Length); 437return Interop.Globalization.EnumCalendarInfo(&EnumCalendarInfoCallback, localeName, calendarId, dataType, (IntPtr)callbackContext);
src\libraries\System.Private.CoreLib\src\System\Globalization\CalendarData.Nls.cs (8)
31return Interop.Kernel32.GetCalendarInfoEx(localeName, (uint)calendar, IntPtr.Zero, calType | CAL_RETURN_NUMBER, IntPtr.Zero, 0, out data) != 0; 41int ret = Interop.Kernel32.GetCalendarInfoEx(localeName, (uint)calendar, IntPtr.Zero, calType, (IntPtr)buffer, BUFFER_LENGTH, IntPtr.Zero); 64private static unsafe Interop.BOOL EnumCalendarInfoCallback(char* lpCalendarInfoString, uint calendar, IntPtr pReserved, void* lParam) 78return Interop.BOOL.TRUE; 82return Interop.BOOL.FALSE; 96private static unsafe Interop.BOOL EnumCalendarsCallback(char* lpCalendarInfoString, uint calendar, IntPtr reserved, void* lParam) 105return Interop.BOOL.TRUE; 109return Interop.BOOL.FALSE;
src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Icu.cs (25)
62return Interop.Globalization.CompareString(_sortHandle, pString1, string1.Length, pString2, string2.Length, options); 92return Interop.Globalization.IndexOf(_sortHandle, pTarget, target.Length, pSource, source.Length, options, matchLengthPtr); 94return Interop.Globalization.LastIndexOf(_sortHandle, pTarget, target.Length, pSource, source.Length, options, matchLengthPtr); 214return Interop.Globalization.IndexOf(_sortHandle, b, target.Length, a, source.Length, options, matchLengthPtr); 216return Interop.Globalization.LastIndexOf(_sortHandle, b, target.Length, a, source.Length, options, matchLengthPtr); 319return Interop.Globalization.IndexOf(_sortHandle, b, target.Length, a, source.Length, options, matchLengthPtr); 321return Interop.Globalization.LastIndexOf(_sortHandle, b, target.Length, a, source.Length, options, matchLengthPtr); 350return Interop.Globalization.StartsWith(_sortHandle, pPrefix, prefix.Length, pSource, source.Length, options, matchLengthPtr); 433return Interop.Globalization.StartsWith(_sortHandle, bp, prefix.Length, ap, source.Length, options, matchLengthPtr); 505return Interop.Globalization.StartsWith(_sortHandle, bp, prefix.Length, ap, source.Length, options, matchLengthPtr); 534return Interop.Globalization.EndsWith(_sortHandle, pSuffix, suffix.Length, pSource, source.Length, options, matchLengthPtr); 618return Interop.Globalization.EndsWith(_sortHandle, bp, suffix.Length, ap, source.Length, options, matchLengthPtr); 690return Interop.Globalization.EndsWith(_sortHandle, bp, suffix.Length, ap, source.Length, options, matchLengthPtr); 728sortKeyLength = Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, null, 0, options); 745if (Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, pSortKey, sortKeyLength, options) != sortKeyLength) 786actualSortKeyLength = Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, pDest, destination.Length, options); 834return Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, null, 0, options); 908sortKeyLength = Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, pSortKey, sortKey.Length, options); 931sortKeyLength = Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, pSortKey, sortKey.Length, options); 975int sortVersion = Interop.Globalization.GetSortVersion(_sortHandle); 995Interop.Globalization.ResultCode resultCode = Interop.Globalization.GetSortHandle(sortName, out result); 997if (resultCode == Interop.Globalization.ResultCode.OutOfMemory) 999else if (resultCode != Interop.Globalization.ResultCode.Success) 1008Interop.Globalization.CloseSortHandle(result);
src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Nls.cs (25)
26int ret = Interop.Kernel32.LCMapStringEx(cultureName, Interop.Kernel32.LCMAP_SORTHANDLE, null, 0, &handle, IntPtr.Size, null, null, IntPtr.Zero); 34ret = Interop.Kernel32.LCMapStringEx(null, Interop.Kernel32.LCMAP_HASH, &a, 1, &hashValue, sizeof(int), null, null, handle); 60int ret = Interop.Kernel32.FindStringOrdinal( 66bIgnoreCase ? Interop.BOOL.TRUE : Interop.BOOL.FALSE); 71Debug.Assert(ret >= 0 || Marshal.GetLastPInvokeError() == Interop.Errors.ERROR_SUCCESS); 140int sortKeyLength = Interop.Kernel32.LCMapStringEx(_sortHandle != IntPtr.Zero ? null : _sortName, 162if (Interop.Kernel32.LCMapStringEx(_sortHandle != IntPtr.Zero ? null : _sortName, 199int result = Interop.Kernel32.CompareStringOrdinal(char1, count1, char2, count2, bIgnoreCase: true); 237int result = Interop.Kernel32.CompareStringEx( 288int result = Interop.Kernel32.FindNLSStringEx( 303Debug.Assert(result >= 0 || Marshal.GetLastPInvokeError() == Interop.Errors.ERROR_SUCCESS); 395int sortKeyLength = Interop.Kernel32.LCMapStringEx(_sortHandle != IntPtr.Zero ? null : _sortName, 409if (Interop.Kernel32.LCMapStringEx(_sortHandle != IntPtr.Zero ? null : _sortName, 494actualSortKeyLength = Interop.Kernel32.LCMapStringEx(_sortHandle != IntPtr.Zero ? null : _sortName, 509if (Marshal.GetLastPInvokeError() == Interop.Errors.ERROR_INSUFFICIENT_BUFFER) 546sortKeyLength = Interop.Kernel32.LCMapStringEx(_sortHandle != IntPtr.Zero ? null : _sortName, 574return Interop.Kernel32.IsNLSDefinedString(Interop.Kernel32.COMPARE_STRING, 0, IntPtr.Zero, pText, text.Length); 621Interop.Kernel32.NlsVersionInfoEx nlsVersion = default; 622nlsVersion.dwNLSVersionInfoSize = sizeof(Interop.Kernel32.NlsVersionInfoEx); 623Interop.Kernel32.GetNLSVersionEx(Interop.Kernel32.COMPARE_STRING, _sortName, &nlsVersion);
src\libraries\System.Private.CoreLib\src\System\Globalization\CultureData.Icu.cs (9)
165if (!Interop.Globalization.GetLocaleName(localeName, buffer, ICU_ULOC_FULLNAME_CAPACITY)) 189if (!Interop.Globalization.GetDefaultLocaleName(buffer, ICU_ULOC_FULLNAME_CAPACITY)) 231bool result = Interop.Globalization.GetLocaleInfoString(localeName, (uint)type, buffer, ICU_ULOC_KEYWORD_AND_VALUES_CAPACITY, uiCultureName); 256bool result = Interop.Globalization.GetLocaleInfoInt(_sWindowsName, (uint)type, ref value); 273bool result = Interop.Globalization.GetLocaleInfoGroupingSizes(_sWindowsName, (uint)type, ref primaryGroupingSize, ref secondaryGroupingSize); 296bool result = Interop.Globalization.GetLocaleTimeFormat(_sWindowsName, shortFormat, buffer, ICU_ULOC_KEYWORD_AND_VALUES_CAPACITY); 334return Interop.Globalization.IsPredefinedLocale(name); 479bufferLength = Interop.Globalization.GetLocales(null, 0); 498bufferLength = Interop.Globalization.GetLocales(chars, bufferLength);
src\libraries\System.Private.CoreLib\src\System\Globalization\CultureData.Nls.cs (37)
36field |= Interop.Kernel32.LOCALE_RETURN_NUMBER; 46return Interop.Kernel32.GetLocaleInfoEx(lpLocaleName, lcType, lpLCData, cchData); 74lctype |= Interop.Kernel32.LOCALE_NOUSEROVERRIDE; 93return GetLocaleInfoExInt(name, Interop.Kernel32.LOCALE_ICONSTRUCTEDLOCALE) != 1; 100return ReescapeWin32String(GetLocaleInfoFromLCType(_sRealName, Interop.Kernel32.LOCALE_STIMEFORMAT, _bUseOverrides)); 108int result = GetLocaleInfoExInt(_sRealName, Interop.Kernel32.LOCALE_IFIRSTDAYOFWEEK | (!_bUseOverrides ? Interop.Kernel32.LOCALE_NOUSEROVERRIDE : 0)); 128Interop.Kernel32.EnumSystemLocalesEx(&EnumSystemLocalesProc, Interop.Kernel32.LOCALE_SPECIFICDATA | Interop.Kernel32.LOCALE_SUPPLEMENTAL, &context, IntPtr.Zero); 183lctype |= Interop.Kernel32.LOCALE_NOUSEROVERRIDE; 350private static unsafe Interop.BOOL EnumSystemLocalesProc(char* lpLocaleString, uint flags, void* contextHandle) 356string? regionName = GetLocaleInfoEx(cultureName, Interop.Kernel32.LOCALE_SISO3166CTRYNAME); 360return Interop.BOOL.FALSE; // we found a match, then stop the enumeration 363return Interop.BOOL.TRUE; 367return Interop.BOOL.FALSE; 373private static unsafe Interop.BOOL EnumAllSystemLocalesProc(char* lpLocaleString, uint flags, void* contextHandle) 378return Interop.BOOL.TRUE; 382return Interop.BOOL.FALSE; 394private static unsafe Interop.BOOL EnumTimeCallback(char* lpTimeFormatString, void* lParam) 399return Interop.BOOL.TRUE; 403return Interop.BOOL.FALSE; 413Interop.Kernel32.EnumTimeFormatsEx(&EnumTimeCallback, localeName, dwFlags, &data); 428uint lcType = (dwFlags == Interop.Kernel32.TIME_NOSECONDS) ? Interop.Kernel32.LOCALE_SSHORTTIME : Interop.Kernel32.LOCALE_STIMEFORMAT; 451return Interop.Kernel32.LocaleNameToLCID(cultureName, Interop.Kernel32.LOCALE_ALLOW_NEUTRAL_NAMES); 470flags |= Interop.Kernel32.LOCALE_NEUTRALDATA | Interop.Kernel32.LOCALE_SPECIFICDATA; 476flags |= Interop.Kernel32.LOCALE_NEUTRALDATA; 481flags |= Interop.Kernel32.LOCALE_SPECIFICDATA; 486flags |= Interop.Kernel32.LOCALE_SUPPLEMENTAL; 491flags |= Interop.Kernel32.LOCALE_SUPPLEMENTAL; 499Interop.Kernel32.EnumSystemLocalesEx(&EnumAllSystemLocalesProc, flags, &context, IntPtr.Zero); 527Interop.Kernel32.EnumSystemLocalesEx(&EnumAllSystemLocalesProc, Interop.Kernel32.LOCALE_REPLACEMENT, &context, IntPtr.Zero);
src\libraries\System.Private.CoreLib\src\System\Globalization\GlobalizationMode.LoadICU.Unix.cs (1)
8private static int LoadICU() => Interop.Globalization.LoadICU();
src\libraries\System.Private.CoreLib\src\System\Globalization\GlobalizationMode.Unix.cs (1)
79Interop.Globalization.InitICUFunctions(icuucLib, icuinLib, version, suffix);
src\libraries\System.Private.CoreLib\src\System\Globalization\IdnMapping.Icu.cs (7)
27actualLength = Interop.Globalization.ToAscii(flags, unicode, count, outputStack, estimatedLength); 35actualLength = Interop.Globalization.ToAscii(flags, unicode, count, null, 0); 45actualLength = Interop.Globalization.ToAscii(flags, unicode, count, pOutputHeap, actualLength); 85int realLen = Interop.Globalization.ToUnicode(flags, ascii, count, output, outputLength); 112(AllowUnassigned ? Interop.Globalization.AllowUnassigned : 0) | 113(UseStd3AsciiRules ? Interop.Globalization.UseStd3AsciiRules : 0); 127if ((flags & Interop.Globalization.UseStd3AsciiRules) == 0)
src\libraries\System.Private.CoreLib\src\System\Globalization\IdnMapping.Nls.cs (7)
21int length = Interop.Normaliz.IdnToAscii(flags, unicode, count, null, 0); 50int length = Interop.Normaliz.IdnToAscii(flags, unicode, count, output, outputLength); 68int length = Interop.Normaliz.IdnToUnicode(flags, ascii, count, null, 0); 97int length = Interop.Normaliz.IdnToUnicode(flags, ascii, count, output, outputLength); 111(AllowUnassigned ? Interop.Normaliz.IDN_ALLOW_UNASSIGNED : 0) | 112(UseStd3AsciiRules ? Interop.Normaliz.IDN_USE_STD3_ASCII_RULES : 0); 123lastError == Interop.Errors.ERROR_INVALID_NAME ? SR.Argument_IdnIllegalName :
src\libraries\System.Private.CoreLib\src\System\Globalization\JapaneseCalendar.Icu.cs (2)
47latestEra = Interop.Globalization.GetLatestJapaneseEra(); 155result = Interop.Globalization.GetJapaneseEraStartDate(era, out startYear, out startMonth, out startDay);
src\libraries\System.Private.CoreLib\src\System\Globalization\Normalization.Icu.cs (2)
29ret = Interop.Globalization.IsNormalized(normalizationForm, pInput, strInput.Length); 69realLen = Interop.Globalization.NormalizeString(normalizationForm, pInput, strInput.Length, pDest, buffer.Length);
src\libraries\System.Private.CoreLib\src\System\Globalization\Normalization.Nls.cs (13)
22Interop.BOOL result; 25result = Interop.Normaliz.IsNormalizedString(normalizationForm, pInput, strInput.Length); 31case Interop.Errors.ERROR_SUCCESS: 34case Interop.Errors.ERROR_INVALID_PARAMETER: 35case Interop.Errors.ERROR_NO_UNICODE_TRANSLATION: 46case Interop.Errors.ERROR_NOT_ENOUGH_MEMORY: 53return result != Interop.BOOL.FALSE; 85realLength = Interop.Normaliz.NormalizeString(normalizationForm, pInput, strInput.Length, pDest, buffer.Length); 91case Interop.Errors.ERROR_SUCCESS: 98case Interop.Errors.ERROR_INSUFFICIENT_BUFFER: 112case Interop.Errors.ERROR_INVALID_PARAMETER: 113case Interop.Errors.ERROR_NO_UNICODE_TRANSLATION: 125case Interop.Errors.ERROR_NOT_ENOUGH_MEMORY:
src\libraries\System.Private.CoreLib\src\System\Globalization\OrdinalCasing.Icu.cs (1)
437Interop.Globalization.InitOrdinalCasingPage(pageNumber, pTable);
src\libraries\System.Private.CoreLib\src\System\Globalization\TextInfo.Icu.cs (3)
29Interop.Globalization.ChangeCaseInvariant(src, srcLen, dstBuffer, dstBufferCapacity, bToUpper); 39Interop.Globalization.ChangeCaseTurkish(src, srcLen, dstBuffer, dstBufferCapacity, bToUpper); 43Interop.Globalization.ChangeCase(src, srcLen, dstBuffer, dstBufferCapacity, bToUpper);
src\libraries\System.Private.CoreLib\src\System\Globalization\TextInfo.Nls.cs (1)
28int ret = Interop.Kernel32.LCMapStringEx(_sortHandle != IntPtr.Zero ? null : _textInfoName,
src\libraries\System.Private.CoreLib\src\System\Guid.Unix.cs (1)
18Interop.GetCryptographicallySecureRandomBytes((byte*)&g, sizeof(Guid));
src\libraries\System.Private.CoreLib\src\System\HashCode.cs (1)
74Interop.GetRandomBytes((byte*)&result, sizeof(uint));
src\libraries\System.Private.CoreLib\src\System\IO\Directory.Unix.cs (2)
48if (Interop.Sys.MkdTemp(pPath) is null) 50Interop.ThrowIOExceptionForLastError();
src\libraries\System.Private.CoreLib\src\System\IO\DriveInfoInternal.Unix.cs (1)
9internal static string[] GetLogicalDrives() => Interop.Sys.GetAllMountPoints();
src\libraries\System.Private.CoreLib\src\System\IO\Enumeration\FileSystemEntry.Unix.cs (9)
14private Interop.Sys.DirectoryEntry _directoryEntry; 25internal fixed char _buffer[Interop.Sys.DirectoryEntry.NameBufferSize]; 30Interop.Sys.DirectoryEntry directoryEntry, 46bool isDirectory = directoryEntry.InodeType == Interop.Sys.NodeType.DT_DIR; 47bool isSymlink = directoryEntry.InodeType == Interop.Sys.NodeType.DT_LNK; 48bool isUnknown = directoryEntry.InodeType == Interop.Sys.NodeType.DT_UNKNOWN; 63entry._directoryEntry.InodeType = Interop.Sys.NodeType.DT_LNK; 98Span<char> buffer = MemoryMarshal.CreateSpan(ref _fileNameBuffer._buffer[0], Interop.Sys.DirectoryEntry.NameBufferSize); 158internal bool IsSymbolicLink => _directoryEntry.InodeType == Interop.Sys.NodeType.DT_LNK;
src\libraries\System.Private.CoreLib\src\System\IO\Enumeration\FileSystemEnumerator.Unix.cs (20)
27private Interop.Sys.DirectoryEntry _entry; 48int size = Interop.Sys.GetReadDirRBufferSize(); 59private bool InternalContinueOnError(Interop.ErrorInfo info, bool ignoreNotFound = false) 62private static bool IsDirectoryNotFound(Interop.ErrorInfo info) 63=> info.Error == Interop.Error.ENOTDIR || info.Error == Interop.Error.ENOENT; 65private static bool IsAccessError(Interop.ErrorInfo info) 66=> info.Error == Interop.Error.EACCES || info.Error == Interop.Error.EBADF 67|| info.Error == Interop.Error.EPERM; 71IntPtr handle = Interop.Sys.OpenDir(path); 74Interop.ErrorInfo info = Interop.Sys.GetLastErrorInfo(); 79throw Interop.GetExceptionForIoErrno(info, path, isDirError: true); 88Interop.Sys.CloseDir(handle); 178fixed (Interop.Sys.DirectoryEntry* e = &_entry) 180result = Interop.Sys.ReadDirR(_directoryHandle, entryBufferPtr, bufferLength, e); 194if (InternalContinueOnError(new Interop.ErrorInfo(result))) 201throw Interop.GetExceptionForIoErrno(new Interop.ErrorInfo(result), _currentPath, isDirError: true);
src\libraries\System.Private.CoreLib\src\System\IO\FileStatus.SetTimes.OtherUnix.cs (1)
22private static Interop.Error SetCreationTimeCore(SafeFileHandle? handle, string? path, long seconds, long nanoseconds) =>
src\libraries\System.Private.CoreLib\src\System\IO\FileStatus.Unix.cs (52)
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); 255Interop.CheckIo(rv, path, asDirectory); 277int rv = handle is not null ? Interop.Sys.FChMod(handle, newMode) : 278Interop.Sys.ChMod(path!, newMode); 279Interop.CheckIo(rv, path, asDirectory); 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); 421Interop.CheckIo(rv, path, asDirectory); 431bool updateCreationTime = checkCreationTime && (_fileCache.Flags & Interop.Sys.FileStatusFlags.HasBirthTime) != 0 && 438Interop.Error error = SetCreationTimeCore(handle, path, _fileCache.BirthTime, _fileCache.BirthTimeNsec); 439if (error != Interop.Error.SUCCESS && error != Interop.Error.ENOTSUP) 441Interop.CheckIo(error, path, asDirectory); 486int rv = handle is not null ? Interop.Sys.FChMod(handle, (int)mode) 487: Interop.Sys.ChMod(path!, (int)mode); 488Interop.CheckIo(rv, path); 506Interop.Sys.FStat(handle, out _fileCache) : 507Interop.Sys.LStat(Path.TrimEndingDirectorySeparator(path), out _fileCache); 511Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); 515case Interop.Error.ENOENT: 518case Interop.Error.ENOTDIR: 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); 579throw Interop.GetExceptionForIoErrno(new Interop.ErrorInfo(errno), new string(path)); 592Interop.Error error = _state == InitializedNotExistsNotADir ? Interop.Error.ENOTDIR : Interop.Error.ENOENT; 593throw Interop.GetExceptionForIoErrno(new Interop.ErrorInfo(error), path);
src\libraries\System.Private.CoreLib\src\System\IO\FileSystem.Exists.Unix.cs (17)
16private static bool DirectoryExists(ReadOnlySpan<char> fullPath, out Interop.ErrorInfo errorInfo) 18Interop.Sys.FileStatus fileinfo; 19errorInfo = default(Interop.ErrorInfo); 21if (Interop.Sys.Stat(fullPath, out fileinfo) < 0) 23errorInfo = Interop.Sys.GetLastErrorInfo(); 27return (fileinfo.Mode & Interop.Sys.FileTypes.S_IFMT) == Interop.Sys.FileTypes.S_IFDIR; 35private static bool FileExists(ReadOnlySpan<char> fullPath, out Interop.ErrorInfo errorInfo) 37Interop.Sys.FileStatus fileinfo; 38errorInfo = default(Interop.ErrorInfo); 49if (Interop.Sys.LStat(fullPath, out fileinfo) < 0) 51errorInfo = Interop.Sys.GetLastErrorInfo(); 57if ((fileinfo.Mode & Interop.Sys.FileTypes.S_IFMT) == Interop.Sys.FileTypes.S_IFLNK) 59if (Interop.Sys.Stat(fullPath, out fileinfo) < 0) 65return (fileinfo.Mode & Interop.Sys.FileTypes.S_IFMT) != Interop.Sys.FileTypes.S_IFDIR;
src\libraries\System.Private.CoreLib\src\System\IO\FileSystem.Unix.cs (120)
51Interop.CheckIo(Interop.Sys.CopyFile(src, dst, fileLength)); 54private static Exception? CreateOpenExceptionForCopyFile(Interop.ErrorInfo error, Interop.Sys.OpenFlags flags, string path) 57if (error.Error == Interop.Error.EEXIST && DirectoryExists(path)) 79if (Interop.Sys.Link(sourceFullPath, destFullPath) >= 0) 89Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); 90if (errorInfo.Error == Interop.Error.EXDEV || // rename fails across devices / mount points 91errorInfo.Error == Interop.Error.EACCES || 92errorInfo.Error == Interop.Error.EPERM || // permissions might not allow creating hard links even if a copy would work 93errorInfo.Error == Interop.Error.EOPNOTSUPP || // links aren't supported by the source file system 94errorInfo.Error == Interop.Error.EMLINK || // too many hard links to the source file 95errorInfo.Error == Interop.Error.ENOSYS) // the file system doesn't support link 103if (errorInfo.Error == Interop.Error.ENOENT) 107throw Interop.GetExceptionForIoErrno(errorInfo, destFullPath, isDirError: true); 111throw Interop.GetExceptionForIoErrno(errorInfo, sourceFullPath); 114else if (errorInfo.Error == Interop.Error.EEXIST) 116throw Interop.GetExceptionForIoErrno(errorInfo, destFullPath); 119throw Interop.GetExceptionForIoErrno(errorInfo); 128Interop.CheckIo(Interop.Sys.LStat(sourceFullPath, out Interop.Sys.FileStatus sourceStat), sourceFullPath); 131if ((sourceStat.Mode & Interop.Sys.FileTypes.S_IFMT) == Interop.Sys.FileTypes.S_IFDIR) 136Interop.Sys.FileStatus destStat; 137if (Interop.Sys.LStat(destFullPath, out destStat) == 0) 140if ((destStat.Mode & Interop.Sys.FileTypes.S_IFMT) == Interop.Sys.FileTypes.S_IFDIR) 156if (Interop.Sys.Unlink(destBackupFullPath) != 0) 158Interop.ErrorInfo errno = Interop.Sys.GetLastErrorInfo(); 159if (errno.Error != Interop.Error.ENOENT) 161throw Interop.GetExceptionForIoErrno(errno, destBackupFullPath); 172if (Interop.Sys.Stat(destFullPath, out _) != 0) 174Interop.ErrorInfo errno = Interop.Sys.GetLastErrorInfo(); 175if (errno.Error == Interop.Error.ENOENT) 177throw Interop.GetExceptionForIoErrno(errno, destBackupFullPath); 183Interop.CheckIo(Interop.Sys.Rename(sourceFullPath, destFullPath)); 197if (Interop.Sys.Rename(sourceFullPath, destFullPath) < 0) 199Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); 200if (errorInfo.Error == Interop.Error.EXDEV) // rename fails across devices / mount points 207throw Interop.GetExceptionForIoErrno(errorInfo, destFullPath); 226Interop.Sys.FileStatus sourceStat, destStat; 227if (Interop.Sys.LStat(sourceFullPath, out sourceStat) == 0 && // source file exists 228(Interop.Sys.LStat(destFullPath, out destStat) != 0 || // dest file does not exist 231Interop.Sys.Rename(sourceFullPath, destFullPath) == 0) // try the rename 243if (Interop.Sys.Unlink(fullPath) < 0) 245Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); 248case Interop.Error.ENOENT: 254throw Interop.GetExceptionForIoErrno(errorInfo, fullPath, true); 257case Interop.Error.EROFS: 261Interop.ErrorInfo fileExistsError; 266fileExistsError.Error == Interop.Error.ENOENT) 271case Interop.Error.EISDIR: 272errorInfo = Interop.Error.EACCES.Info(); 275throw Interop.GetExceptionForIoErrno(errorInfo, fullPath); 298int result = Interop.Sys.MkDir(path, (int)unixCreateMode); 304Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); 305if (errorInfo.Error == Interop.Error.EEXIST && DirectoryExists(fullPath)) 309else if (errorInfo.Error == Interop.Error.ENOENT) // Some parts of the path don't exist yet. 315throw Interop.GetExceptionForIoErrno(errorInfo, fullPath); 342int result = Interop.Sys.MkDir(mkdirPath, (int)DefaultUnixCreateDirectoryMode); 348Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); 349if (errorInfo.Error == Interop.Error.ENOENT) 357else if (errorInfo.Error == Interop.Error.EEXIST) 365throw Interop.GetExceptionForIoErrno(errorInfo, mkdirPath.ToString()); 375int result = Interop.Sys.MkDir(mkdirPath, (int)mode); 378Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); 379if (errorInfo.Error == Interop.Error.EEXIST) 394throw Interop.GetExceptionForIoErrno(errorInfo, mkdirPath.ToString()); 416if (!isCaseSensitiveRename && Interop.Sys.LStat(destNoDirectorySeparator, out Interop.Sys.FileStatus destFileStatus) >= 0) 421if (Interop.Sys.LStat(srcNoDirectorySeparator, out Interop.Sys.FileStatus sourceFileStatus) < 0) 440else if ((sourceFileStatus.Mode & Interop.Sys.FileTypes.S_IFMT) != Interop.Sys.FileTypes.S_IFDIR 451if (Interop.Sys.Rename(sourceFullPath, destNoDirectorySeparator) < 0) 453Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); 456case Interop.Error.EACCES: // match Win32 exception 458case Interop.Error.ENOENT: 460case Interop.Error.ENOTDIR: // sourceFullPath exists and it's not a directory 463throw Interop.GetExceptionForIoErrno(errorInfo); 529if (Interop.Sys.RmDir(fullPath) < 0) 531Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); 533if (errorInfo.Error == Interop.Error.ENOTEMPTY) 540else if (errorInfo.Error == Interop.Error.ENOENT) 548else if (DirectoryExists(fullPath, out Interop.ErrorInfo existErr)) 551if (topLevel && errorInfo.Error == Interop.Error.ENOTDIR) 557else if (existErr.Error == Interop.Error.ENOENT) 563if (errorInfo.Error == Interop.Error.EACCES || 564errorInfo.Error == Interop.Error.EPERM || 565errorInfo.Error == Interop.Error.EROFS) 570throw Interop.GetExceptionForIoErrno(errorInfo, fullPath, isDirError: true); 589throw Interop.GetExceptionForIoErrno(new Interop.ErrorInfo(Interop.Error.ENOENT), fullPath); 608throw Interop.GetExceptionForIoErrno(new Interop.ErrorInfo(Interop.Error.ENOENT), fullPath); 664internal static string? GetLinkTarget(ReadOnlySpan<char> linkPath, bool isDirectory) => Interop.Sys.ReadLink(linkPath); 668Interop.CheckIo(Interop.Sys.SymLink(pathToTarget, path), path); 674ValueStringBuilder sb = new(Interop.DefaultPathBufferSize); 677string? linkTarget = Interop.Sys.ReadLink(linkPath); 681Interop.Error error = Interop.Sys.GetLastError(); 683if (error == Interop.Error.EINVAL) 688throw Interop.GetExceptionForIoErrno(new Interop.ErrorInfo(error), linkPath, isDirectory); 710current = Interop.Sys.ReadLink(sb.AsSpan());
src\libraries\System.Private.CoreLib\src\System\IO\Path.cs (1)
282Interop.GetRandomBytes(pKey, KeyLength);
src\libraries\System.Private.CoreLib\src\System\IO\Path.Unix.cs (9)
19bool result = Interop.Sys.LStat(fullPath, out Interop.Sys.FileStatus fileInfo) == Interop.Errors.ERROR_SUCCESS; 20isDirectory = result && (fileInfo.Mode & Interop.Sys.FileTypes.S_IFMT) == Interop.Sys.FileTypes.S_IFDIR; 62path = Combine(Interop.Sys.GetCwd(), path); 121IntPtr fd = Interop.CheckIo(Interop.Sys.MksTemps(pPath, SuffixByteLength), tempPath, isDirError: true); 122Interop.Sys.Close(fd); // ignore any errors from close; nothing to do if cleanup isn't possible
src\libraries\System.Private.CoreLib\src\System\IO\PersistedFiles.Unix.cs (6)
66const int BufLen = Interop.Sys.Passwd.InitialBufferSize; 95Interop.Sys.Passwd passwd; 96int error = Interop.Sys.GetPwUidR(Interop.Sys.GetEUid(), out passwd, buf, bufLen); 115var errorInfo = new Interop.ErrorInfo(error); 119if (errorInfo.Error == Interop.Error.ERANGE)
src\libraries\System.Private.CoreLib\src\System\IO\RandomAccess.Unix.cs (27)
23FileStreamHelpers.CheckFileCall(Interop.Sys.FTruncate(handle, length), handle.Path); 36result = Interop.Sys.PRead(handle, bufPtr, buffer.Length, fileOffset); 41Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); 43if (errorInfo.Error == Interop.Error.ENXIO || 44errorInfo.Error == Interop.Error.ESPIPE) 47result = Interop.Sys.Read(handle, bufPtr, buffer.Length); 53result = Interop.Sys.Read(handle, bufPtr, buffer.Length); 64Span<Interop.Sys.IOVector> vectors = buffers.Count <= IovStackThreshold ? stackalloc Interop.Sys.IOVector[IovStackThreshold] : new Interop.Sys.IOVector[buffers.Count]; 74vectors[i] = new Interop.Sys.IOVector { Base = (byte*)memoryHandle.Pointer, Count = (UIntPtr)buffer.Length }; 78fixed (Interop.Sys.IOVector* pinnedVectors = &MemoryMarshal.GetReference(vectors)) 80result = Interop.Sys.PReadV(handle, pinnedVectors, buffers.Count, fileOffset); 113bytesWritten = Interop.Sys.PWrite(handle, bufPtr, bytesToWrite, fileOffset); 118Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); 120if (errorInfo.Error == Interop.Error.ENXIO || 121errorInfo.Error == Interop.Error.ESPIPE) 124bytesWritten = Interop.Sys.Write(handle, bufPtr, bytesToWrite); 130bytesWritten = Interop.Sys.Write(handle, bufPtr, bytesToWrite); 170Span<Interop.Sys.IOVector> vectors = buffersCount <= IovStackThreshold ? 171stackalloc Interop.Sys.IOVector[IovStackThreshold] : 172new Interop.Sys.IOVector[buffersCount]; 187vectors[i] = new Interop.Sys.IOVector { Base = firstBufferOffset + (byte*)memoryHandle.Pointer, Count = (UIntPtr)(buffer.Length - firstBufferOffset) }; 199fixed (Interop.Sys.IOVector* pinnedVectors = &MemoryMarshal.GetReference(vectors)) 201bytesWritten = Interop.Sys.PWriteV(handle, pinnedVectors, buffersCount, fileOffset);
src\libraries\System.Private.CoreLib\src\System\IO\Strategies\FileStreamHelpers.Unix.cs (21)
23Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); 24if (!(ignoreNotSupported && errorInfo.Error == Interop.Error.ENOTSUP)) 26throw Interop.GetExceptionForIoErrno(errorInfo, path); 34CheckFileCall(Interop.Sys.LSeek(handle, offset, (Interop.Sys.SeekWhence)(int)origin), handle.Path); // SeekOrigin values are the same as Interop.libc.SeekWhence values 37throw Interop.GetExceptionForIoErrno(new Interop.ErrorInfo(Interop.Error.EINVAL), handle.Path); 42if (Interop.Sys.FSync(handle) < 0) 44Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); 47case Interop.Error.EROFS: 48case Interop.Error.EINVAL: 49case Interop.Error.ENOTSUP: 54throw Interop.GetExceptionForIoErrno(errorInfo, handle.Path); 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);
src\libraries\System.Private.CoreLib\src\System\Marvin.cs (1)
244Interop.GetRandomBytes((byte*)&seed, sizeof(ulong));
src\libraries\System.Private.CoreLib\src\System\Random.Xoshiro256StarStarImpl.cs (1)
38Interop.GetRandomBytes((byte*)ptr, 4 * sizeof(ulong));
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshal.Unix.cs (7)
85Interop.Sys.Free(pvNative); 104void* p = Interop.Sys.Malloc((nuint)cbNative & ~WIN32_ALLOC_ALIGN); 130void* p = Interop.Sys.Malloc((nuint)cbNative & ~WIN32_ALLOC_ALIGN); 153Interop.Sys.Free((byte*)ptr - sizeof(nuint)); 178return Interop.Sys.GetErrNo(); 190Interop.Sys.SetErrNo(error); 200return Interop.Sys.StrError(error);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\NativeLibrary.cs (1)
257result = Interop.Sys.GetDefaultSearchOrderPseudoHandle();
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\NativeMemory.Unix.cs (8)
46void* result = (adjustedByteCount < byteCount) ? null : Interop.Sys.AlignedAlloc(adjustedAlignment, adjustedByteCount); 67Interop.Sys.AlignedFree(ptr); 107void* result = (adjustedByteCount < byteCount) ? null : Interop.Sys.AlignedRealloc(ptr, adjustedAlignment, adjustedByteCount); 129void* result = Interop.Sys.Malloc((byteCount != 0) ? byteCount : 1); 155result = Interop.Sys.Calloc(elementCount, elementSize); 160result = Interop.Sys.Malloc(1); 182Interop.Sys.Free(ptr); 200void* result = Interop.Sys.Realloc(ptr, (byteCount != 0) ? byteCount : 1);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\PosixSignalRegistration.Unix.cs (8)
16if (!Interop.Sys.InitializeTerminalAndSignalHandling()) 18Interop.ThrowIOExceptionForLastError(); 21Interop.Sys.SetPosixSignalHandler(&OnPosixSignal); 28int signo = Interop.Sys.GetPlatformSignalNumber(signal); 45!Interop.Sys.EnablePosixSignalHandling(signo)) 47Interop.ThrowIOExceptionForLastError(); 70Interop.Sys.DisablePosixSignalHandling(token.SigNo); 136Interop.Sys.HandleNonCanceledPosixSignal(signo);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\RuntimeInformation.Unix.cs (3)
13public static string OSDescription => s_osDescription ??= (GetPrettyOSDescription() ?? Interop.Sys.GetUnixVersion()); 23osArch = Interop.Sys.GetOSArchitecture(); 38return Interop.OSReleaseFile.GetPrettyName();
src\libraries\System.Private.CoreLib\src\System\Runtime\Loader\AssemblyDependencyResolver.cs (4)
48var errorWriter = new Interop.HostPolicy.corehost_error_writer_fn(message => errorMessage.AppendLine(Marshal.PtrToStringAuto(message))); 51IntPtr previousErrorWriterPtr = Interop.HostPolicy.corehost_set_error_writer(errorWriterPtr); 57returnCode = Interop.HostPolicy.corehost_resolve_component_dependencies( 69Interop.HostPolicy.corehost_set_error_writer(previousErrorWriterPtr);
src\libraries\System.Private.CoreLib\src\System\Threading\EventWaitHandle.Windows.cs (11)
12private const uint AccessRights = (uint)Interop.Kernel32.MAXIMUM_ALLOWED | Interop.Kernel32.SYNCHRONIZE | Interop.Kernel32.EVENT_MODIFY_STATE; 25uint eventFlags = initialState ? Interop.Kernel32.CREATE_EVENT_INITIAL_SET : 0; 27eventFlags |= (uint)Interop.Kernel32.CREATE_EVENT_MANUAL_RESET; 29SafeWaitHandle handle = Interop.Kernel32.CreateEventEx(IntPtr.Zero, name, eventFlags, AccessRights); 35if (!string.IsNullOrEmpty(name) && errorCode == Interop.Errors.ERROR_INVALID_HANDLE) 40createdNew = errorCode != Interop.Errors.ERROR_ALREADY_EXISTS; 76bool res = Interop.Kernel32.ResetEvent(SafeWaitHandle); 84bool res = Interop.Kernel32.SetEvent(SafeWaitHandle); 92return Interop.Kernel32.SetEvent(waitHandle);
src\libraries\System.Private.CoreLib\src\System\Threading\Lock.NonNativeAot.cs (1)
61uint id = Interop.Sys.TryGetUInt32OSThreadId();
src\libraries\System.Private.CoreLib\src\System\Threading\LowLevelMonitor.Unix.cs (7)
14_nativeMonitor = Interop.Sys.LowLevelMonitor_Create(); 28Interop.Sys.LowLevelMonitor_Destroy(_nativeMonitor); 34Interop.Sys.LowLevelMonitor_Acquire(_nativeMonitor); 39Interop.Sys.LowLevelMonitor_Release(_nativeMonitor); 44Interop.Sys.LowLevelMonitor_Wait(_nativeMonitor); 57return Interop.Sys.LowLevelMonitor_TimedWait(_nativeMonitor, timeoutMilliseconds); 62Interop.Sys.LowLevelMonitor_Signal_Release(_nativeMonitor);
src\libraries\System.Private.CoreLib\src\System\Threading\PortableThreadPool.Unix.cs (2)
15private Interop.Sys.ProcessCpuInformation _cpuInfo; 18Interop.Sys.GetCpuUtilization(ref _cpuInfo) / Environment.ProcessorCount;
src\libraries\System.Private.CoreLib\src\System\Threading\Semaphore.Windows.cs (7)
13private const uint AccessRights = (uint)Interop.Kernel32.MAXIMUM_ALLOWED | Interop.Kernel32.SYNCHRONIZE | Interop.Kernel32.SEMAPHORE_MODIFY_STATE; 30SafeWaitHandle myHandle = Interop.Kernel32.CreateSemaphoreEx(IntPtr.Zero, initialCount, maximumCount, name, 0, AccessRights); 37if (!string.IsNullOrEmpty(name) && errorCode == Interop.Errors.ERROR_INVALID_HANDLE) 43createdNew = errorCode != Interop.Errors.ERROR_ALREADY_EXISTS; 81if (!Interop.Kernel32.ReleaseSemaphore(SafeWaitHandle!, releaseCount, out int previousCount))
src\libraries\System.Private.CoreLib\src\System\Threading\Thread.Unix.cs (1)
21internal static int GetCurrentProcessorNumber() => Interop.Sys.SchedGetCpu();
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.FullGlobalizationData.cs (2)
26int length = Interop.Globalization.IanaIdToWindowsId(ianaId, buffer, 100); 91int length = Interop.Globalization.WindowsIdToIanaId(windowsId, regionPtr, buffer, 100);
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.FullGlobalizationData.Unix.cs (13)
47GetDisplayName(UtcId, Interop.Globalization.TimeZoneDisplayNameType.Standard, uiCulture.Name, ref standardDisplayName); 92GetDisplayName(timeZoneId, Interop.Globalization.TimeZoneDisplayNameType.Standard, UICulture.Name, ref displayName); 97GetDisplayName(timeZoneId, Interop.Globalization.TimeZoneDisplayNameType.DaylightSavings, UICulture.Name, ref displayName); 101private static unsafe void GetDisplayName(string timeZoneId, Interop.Globalization.TimeZoneDisplayNameType nameType, string uiCulture, ref string? displayName) 109bool result = Interop.CallStringMethod( 118return Interop.Globalization.GetTimeZoneDisplayName(locale, id, type, bufferPtr, buffer.Length); 129result = Interop.CallStringMethod( 138return Interop.Globalization.GetTimeZoneDisplayName(locale, id, type, bufferPtr, buffer.Length); 177GetDisplayName(timeZoneId, Interop.Globalization.TimeZoneDisplayNameType.Generic, uiCulture.Name, ref genericName); 186GetDisplayName(timeZoneId, Interop.Globalization.TimeZoneDisplayNameType.GenericLocation, uiCulture.Name, ref genericLocationName); 193GetDisplayName(GmtId, Interop.Globalization.TimeZoneDisplayNameType.GenericLocation, uiCulture.Name, ref gmtLocationName); 203GetDisplayName(GmtId, Interop.Globalization.TimeZoneDisplayNameType.Generic, uiCulture.Name, ref gmtGenericName); 278GetDisplayName(timeZoneId, Interop.Globalization.TimeZoneDisplayNameType.ExemplarCity, uiCultureName, ref exemplarCityName);
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.Unix.NonAndroid.cs (17)
237string? symlinkPath = Interop.Sys.ReadLink(tzFilePath); 253private static string? GetDirectoryEntryFullPath(ref Interop.Sys.DirectoryEntry dirent, string currentPath) 255ReadOnlySpan<char> direntName = dirent.GetName(stackalloc char[Interop.Sys.DirectoryEntry.NameBufferSize]); 271int bufferSize = Interop.Sys.GetReadDirRBufferSize(); 281IntPtr dirHandle = Interop.Sys.OpenDir(currentPath); 284throw Interop.GetExceptionForIoErrno(Interop.Sys.GetLastErrorInfo(), currentPath, isDirError: true); 290Interop.Sys.DirectoryEntry dirent; 291while (Interop.Sys.ReadDirR(dirHandle, dirBufferPtr, bufferSize, &dirent) == 0) 300if (dirent.InodeType == Interop.Sys.NodeType.DT_DIR) 305else if (dirent.InodeType == Interop.Sys.NodeType.DT_LNK || dirent.InodeType == Interop.Sys.NodeType.DT_UNKNOWN) 310Interop.Sys.FileStatus fileinfo; 311if (Interop.Sys.Stat(fullPath, out fileinfo) >= 0) 313isDir = (fileinfo.Mode & Interop.Sys.FileTypes.S_IFMT) == Interop.Sys.FileTypes.S_IFDIR; 343Interop.Sys.CloseDir(dirHandle);
src\System\Enum.CoreCLR.cs (3)
15private static partial void GetEnumValuesAndNames(QCallTypeHandle enumType, ObjectHandleOnStack values, ObjectHandleOnStack names, Interop.BOOL getNames); 104getNames ? Interop.BOOL.TRUE : Interop.BOOL.FALSE);
src\System\Reflection\RuntimeAssembly.cs (2)
275internal static partial Interop.BOOL GetIsCollectible(QCallAssembly assembly); 282return GetIsCollectible(new QCallAssembly(ref runtimeAssembly)) != Interop.BOOL.FALSE;
src\System\Reflection\RuntimeCustomAttributeData.cs (1)
1723new QCallModule(ref decoratedModule)) != Interop.BOOL.FALSE;
src\System\Reflection\RuntimeMethodInfo.CoreCLR.cs (1)
322public override bool IsCollectible => RuntimeMethodHandle.GetIsCollectible(new RuntimeMethodHandleInternal(m_handle)) != Interop.BOOL.FALSE;
src\System\RuntimeHandles.cs (13)
281Interop.BOOL fCtorIsPublicTemp = default; 291ctorIsPublic = fCtorIsPublicTemp != Interop.BOOL.FALSE; 300Interop.BOOL* pfCtorIsPublic); 514internal static partial void GetInstantiation(QCallTypeHandle type, ObjectHandleOnStack types, Interop.BOOL fAsRuntimeTypeArray); 520GetInstantiation(new QCallTypeHandle(ref nativeHandle), ObjectHandleOnStack.Create(ref types), Interop.BOOL.TRUE); 528GetInstantiation(new QCallTypeHandle(ref nativeHandle), ObjectHandleOnStack.Create(ref types), Interop.BOOL.FALSE); 605internal static partial Interop.BOOL IsCollectible(QCallTypeHandle handle); 835internal static partial Interop.BOOL GetIsCollectible(RuntimeMethodHandleInternal handle); 838internal static partial Interop.BOOL IsCAVisibleFromDecoratedType( 924private static partial void GetMethodInstantiation(RuntimeMethodHandleInternal method, ObjectHandleOnStack types, Interop.BOOL fAsRuntimeTypeArray); 929GetMethodInstantiation(EnsureNonNullMethodInfo(method).Value, ObjectHandleOnStack.Create(ref types), Interop.BOOL.TRUE); 937GetMethodInstantiation(method, ObjectHandleOnStack.Create(ref types), Interop.BOOL.TRUE); 944GetMethodInstantiation(EnsureNonNullMethodInfo(method).Value, ObjectHandleOnStack.Create(ref types), Interop.BOOL.FALSE);
src\System\RuntimeType.CoreCLR.cs (1)
3250return RuntimeTypeHandle.IsCollectible(new QCallTypeHandle(ref thisType)) != Interop.BOOL.FALSE;
src\System\StubHelpers.cs (3)
144Interop.BOOL defaultCharUsed = Interop.BOOL.FALSE; 165if (defaultCharUsed != Interop.BOOL.FALSE)
src\System\Threading\Mutex.CoreCLR.Unix.cs (10)
23if (errorCode == Interop.Errors.ERROR_FILENAME_EXCED_RANGE) 26if (errorCode == Interop.Errors.ERROR_INVALID_HANDLE) 32createdNew = errorCode != Interop.Errors.ERROR_ALREADY_EXISTS; 51if (errorCode == Interop.Errors.ERROR_FILENAME_EXCED_RANGE) 56if (Interop.Errors.ERROR_FILE_NOT_FOUND == errorCode || Interop.Errors.ERROR_INVALID_NAME == errorCode) 58if (Interop.Errors.ERROR_PATH_NOT_FOUND == errorCode) 60if (Interop.Errors.ERROR_INVALID_HANDLE == errorCode) 75if (!Interop.Kernel32.ReleaseMutex(SafeWaitHandle)) 107errorCode = mutexHandle.IsInvalid ? Marshal.GetLastPInvokeError() : Interop.Errors.ERROR_SUCCESS;
src\System\Threading\Thread.CoreCLR.cs (5)
152private static partial Interop.BOOL YieldInternal(); 154public static bool Yield() => YieldInternal() != Interop.BOOL.FALSE; 196SetIsBackground(GetNativeHandle(), value ? Interop.BOOL.TRUE : Interop.BOOL.FALSE); 209private static partial void SetIsBackground(ThreadHandle t, Interop.BOOL value);
src\System\Threading\WaitHandle.CoreCLR.cs (1)
29if (ret == Interop.Errors.ERROR_TOO_MANY_POSTS)