diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetNodeName.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetNodeName.cs deleted file mode 100644 index 0c2f1ee7078b1f..00000000000000 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetNodeName.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Diagnostics; -using System.Runtime.InteropServices; -using System.Text; - -internal static partial class Interop -{ - internal static partial class Sys - { - [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetNodeName", SetLastError = true)] - private static unsafe partial int GetNodeName(byte* name, ref int len); - - internal static unsafe string GetNodeName() - { - // max value of _UTSNAME_LENGTH on known Unix platforms is 1024. - const int _UTSNAME_LENGTH = 1024; - int len = _UTSNAME_LENGTH; - byte* name = stackalloc byte[_UTSNAME_LENGTH]; - int err = GetNodeName(name, ref len); - if (err != 0) - { - // max domain name can be 255 chars. - Debug.Fail($"{nameof(GetNodeName)} failed with error {err}"); - throw new InvalidOperationException($"{nameof(GetNodeName)}: {err}"); - } - - // Marshal.PtrToStringAnsi uses UTF8 on Unix. - return Marshal.PtrToStringAnsi((IntPtr)name); - } - } -} diff --git a/src/libraries/System.Runtime.Extensions/tests/System.Runtime.Extensions.Tests.csproj b/src/libraries/System.Runtime.Extensions/tests/System.Runtime.Extensions.Tests.csproj index 54240fecb8f7e5..71788c421b44ed 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System.Runtime.Extensions.Tests.csproj +++ b/src/libraries/System.Runtime.Extensions/tests/System.Runtime.Extensions.Tests.csproj @@ -76,7 +76,7 @@ - + diff --git a/src/libraries/System.Runtime.Extensions/tests/System/Environment.MachineName.cs b/src/libraries/System.Runtime.Extensions/tests/System/Environment.MachineName.cs index eac8bf18bb1206..658447d52339cf 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/Environment.MachineName.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/Environment.MachineName.cs @@ -18,13 +18,13 @@ public void TestMachineNameProperty() internal static string GetComputerName() { #if !Unix - return Environment.GetEnvironmentVariable("COMPUTERNAME"); + return Environment.GetEnvironmentVariable("COMPUTERNAME"); #else - if (PlatformDetection.IsBrowser) - return "localhost"; - string temp = Interop.Sys.GetNodeName(); - int index = temp.IndexOf('.'); - return index < 0 ? temp : temp.Substring(0, index); + if (PlatformDetection.IsBrowser) + return "localhost"; + string temp = Interop.Sys.GetHostName(); + int index = temp.IndexOf('.'); + return index < 0 ? temp : temp.Substring(0, index); #endif } } diff --git a/src/mono/System.Private.CoreLib/src/System/TypeSpec.cs b/src/mono/System.Private.CoreLib/src/System/TypeSpec.cs index c73a1717d306b8..83bb08b2ec9dc9 100644 --- a/src/mono/System.Private.CoreLib/src/System/TypeSpec.cs +++ b/src/mono/System.Private.CoreLib/src/System/TypeSpec.cs @@ -305,27 +305,6 @@ internal static string UnescapeInternalName(string displayName) return res.ToString(); } - internal static bool NeedsEscaping(string internalName) - { - foreach (char c in internalName) - { - switch (c) - { - case ',': - case '+': - case '*': - case '&': - case '[': - case ']': - case '\\': - return true; - default: - break; - } - } - return false; - } - internal Type? Resolve(Func assemblyResolver, Func typeResolver, bool throwOnError, bool ignoreCase, ref StackCrawlMark stackMark) { Assembly? asm = null; diff --git a/src/native/libs/System.Native/CMakeLists.txt b/src/native/libs/System.Native/CMakeLists.txt index 60780bf85c7089..45bfea5a8e7b62 100644 --- a/src/native/libs/System.Native/CMakeLists.txt +++ b/src/native/libs/System.Native/CMakeLists.txt @@ -27,7 +27,6 @@ set(NATIVE_SOURCES pal_process.c pal_random.c pal_runtimeinformation.c - pal_runtimeextensions.c pal_signal.c pal_string.c pal_tcpstate.c diff --git a/src/native/libs/System.Native/entrypoints.c b/src/native/libs/System.Native/entrypoints.c index 8b251d93e3f1d9..41c379cb90db51 100644 --- a/src/native/libs/System.Native/entrypoints.c +++ b/src/native/libs/System.Native/entrypoints.c @@ -21,7 +21,6 @@ #include "pal_networkstatistics.h" #include "pal_process.h" #include "pal_random.h" -#include "pal_runtimeextensions.h" #include "pal_runtimeinformation.h" #include "pal_searchpath.h" #include "pal_signal.h" @@ -214,7 +213,6 @@ static const Entry s_sysNative[] = DllImportEntry(SystemNative_GetProcessPath) DllImportEntry(SystemNative_GetNonCryptographicallySecureRandomBytes) DllImportEntry(SystemNative_GetCryptographicallySecureRandomBytes) - DllImportEntry(SystemNative_GetNodeName) DllImportEntry(SystemNative_GetUnixName) DllImportEntry(SystemNative_GetUnixRelease) DllImportEntry(SystemNative_GetUnixVersion) diff --git a/src/native/libs/System.Native/pal_runtimeextensions.c b/src/native/libs/System.Native/pal_runtimeextensions.c deleted file mode 100644 index b4690ecd6ef9bf..00000000000000 --- a/src/native/libs/System.Native/pal_runtimeextensions.c +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#include "pal_runtimeextensions.h" -#include "pal_types.h" -#include -#include - -int32_t SystemNative_GetNodeName(char* version, int* capacity) -{ - struct utsname _utsname; - if (uname(&_utsname) != -1) - { - int r = snprintf(version, (size_t)(*capacity), "%s", _utsname.nodename); - if (r > *capacity) - { - *capacity = r + 1; - return -1; - } - } - - return 0; -} diff --git a/src/native/libs/System.Native/pal_runtimeextensions.h b/src/native/libs/System.Native/pal_runtimeextensions.h deleted file mode 100644 index 99d14765d412c6..00000000000000 --- a/src/native/libs/System.Native/pal_runtimeextensions.h +++ /dev/null @@ -1,9 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#pragma once - -#include "pal_compiler.h" -#include "pal_types.h" - -PALEXPORT int32_t SystemNative_GetNodeName(char* version, int* capacity);