diff --git a/src/coreclr/pal/src/thread/process.cpp b/src/coreclr/pal/src/thread/process.cpp index 10431818c00045..feba564495ea22 100644 --- a/src/coreclr/pal/src/thread/process.cpp +++ b/src/coreclr/pal/src/thread/process.cpp @@ -1153,6 +1153,9 @@ ExitProcess( else { WARN("thread re-called ExitProcess\n"); +#if defined(TARGET_ANDROID) + __android_log_print (ANDROID_LOG_INFO, "CoreCLR", "End process at %s:%u", __FILE_NAME__, __LINE__); +#endif PROCEndProcess(GetCurrentProcess(), uExitCode, FALSE); } } @@ -1177,6 +1180,9 @@ ExitProcess( */ if (PALInitLock() && PALIsInitialized()) { +#if defined(TARGET_ANDROID) + __android_log_print (ANDROID_LOG_INFO, "CoreCLR", "End process at %s:%u", __FILE_NAME__, __LINE__); +#endif PROCEndProcess(GetCurrentProcess(), uExitCode, FALSE); /* Should not get here, because we terminate the current process */ @@ -1214,7 +1220,9 @@ TerminateProcess( PERF_ENTRY(TerminateProcess); ENTRY("TerminateProcess(hProcess=%p, uExitCode=%u)\n",hProcess, uExitCode ); - +#if defined(TARGET_ANDROID) + __android_log_print (ANDROID_LOG_INFO, "CoreCLR", "End process at %s:%u", __FILE_NAME__, __LINE__); +#endif ret = PROCEndProcess(hProcess, uExitCode, TRUE); LOGEXIT("TerminateProcess returns BOOL %d\n", ret); @@ -1239,6 +1247,9 @@ RaiseFailFastException( PERF_ENTRY(RaiseFailFastException); ENTRY("RaiseFailFastException"); +#if defined(TARGET_ANDROID) + __android_log_print (ANDROID_LOG_INFO, "CoreCLR", "About to abort at %s:%u", __FILE_NAME__, __LINE__); +#endif TerminateCurrentProcessNoExit(TRUE); for (;;) PROCAbort(); @@ -1318,6 +1329,9 @@ static BOOL PROCEndProcess(HANDLE hProcess, UINT uExitCode, BOOL bTerminateUncon // (2) can invoke CrashReporter or produce a coredump, which is appropriate for TerminateProcess calls // TerminationRequestHandlingRoutine in synchmanager.cpp sets the exit code to this special value. The // Watson analyzer needs to know that the process was terminated with a SIGTERM. +#if defined(TARGET_ANDROID) + __android_log_print (ANDROID_LOG_INFO, "CoreCLR", "About to abort in %s:%u", __FILE_NAME__, __LINE__); +#endif PROCAbort(uExitCode == (128 + SIGTERM) ? SIGTERM : SIGABRT); } else @@ -2620,12 +2634,18 @@ InitializeFlushProcessWriteBuffers() #endif // TARGET_APPLE } +#if defined(TARGET_ANDROID) +#define FATAL_ASSERT_PRINT(msg) __android_log_print (ANDROID_LOG_INFO, "CoreCLR", "About to abort in %s:%u. %s", __FILE_NAME__, __LINE__, (msg)) +#else +#define FATAL_ASSERT_PRINT(msg) fprintf(stderr, "FATAL ERROR: " msg) +#endif + #define FATAL_ASSERT(e, msg) \ do \ { \ if (!(e)) \ { \ - fprintf(stderr, "FATAL ERROR: " msg); \ + FATAL_ASSERT_PRINT(msg); \ PROCAbort(); \ } \ } \ diff --git a/src/coreclr/vm/eepolicy.cpp b/src/coreclr/vm/eepolicy.cpp index 14157b1f77e697..5b22965b947058 100644 --- a/src/coreclr/vm/eepolicy.cpp +++ b/src/coreclr/vm/eepolicy.cpp @@ -20,6 +20,10 @@ #include "dwreport.h" #endif // !TARGET_UNIX +#if defined(TARGET_ANDROID) +#include +#endif + #include "eventtrace.h" #undef ExitProcess @@ -58,7 +62,9 @@ void SafeExitProcess(UINT exitCode, ShutdownCompleteAction sca = SCA_ExitProcess { // disabled because if we fault in this code path we will trigger our Watson code CONTRACT_VIOLATION(ThrowsViolation); - +#if defined(TARGET_ANDROID) + __android_log_print (ANDROID_LOG_INFO, "CoreCLR", "End process at %s:%u", __FILE_NAME__, __LINE__); +#endif CrashDumpAndTerminateProcess(exitCode); } else if (sca == SCA_ExitProcessWhenShutdownComplete) @@ -737,7 +743,9 @@ void DECLSPEC_NORETURN EEPolicy::HandleFatalStackOverflow(EXCEPTION_POINTERS *pE WatsonLastChance(pThread, pExceptionInfo, (fTreatAsNativeUnhandledException == FALSE)? TypeOfReportedError::UnhandledException: TypeOfReportedError::NativeThreadUnhandledException); } - +#if defined(TARGET_ANDROID) + __android_log_print (ANDROID_LOG_INFO, "CoreCLR", "End process at %s:%u", __FILE_NAME__, __LINE__); +#endif CrashDumpAndTerminateProcess(COR_E_STACKOVERFLOW); UNREACHABLE(); } diff --git a/src/coreclr/vm/excep.cpp b/src/coreclr/vm/excep.cpp index d4441504c0811e..fa431ee0621bb8 100644 --- a/src/coreclr/vm/excep.cpp +++ b/src/coreclr/vm/excep.cpp @@ -25,6 +25,10 @@ #include "virtualcallstub.h" #include "typestring.h" +#if defined(TARGET_ANDROID) +#include +#endif + #ifndef TARGET_UNIX #include "dwreport.h" #endif // !TARGET_UNIX @@ -3944,6 +3948,9 @@ void CrashDumpAndTerminateProcess(UINT exitCode) { #ifdef HOST_WINDOWS CreateCrashDumpIfEnabled(exitCode == COR_E_STACKOVERFLOW); +#endif +#if defined(TARGET_ANDROID) + __android_log_print (ANDROID_LOG_INFO, "CoreCLR", "End process at %s:%u", __FILE_NAME__, __LINE__); #endif TerminateProcess(GetCurrentProcess(), exitCode); } @@ -4074,6 +4081,9 @@ LONG UserBreakpointFilter(EXCEPTION_POINTERS* pEP) } // Otherwise, we terminate the process. +#if defined(TARGET_ANDROID) + __android_log_print (ANDROID_LOG_INFO, "CoreCLR", "End process at %s:%u", __FILE_NAME__, __LINE__); +#endif CrashDumpAndTerminateProcess(STATUS_BREAKPOINT); // Shouldn't get here ... diff --git a/src/coreclr/vm/exceptionhandling.cpp b/src/coreclr/vm/exceptionhandling.cpp index f57a3ee9918230..064223e494ffa4 100644 --- a/src/coreclr/vm/exceptionhandling.cpp +++ b/src/coreclr/vm/exceptionhandling.cpp @@ -21,6 +21,10 @@ #include "exinfo.h" #include "configuration.h" +#if defined(TARGET_ANDROID) +#include +#endif + #if defined(TARGET_X86) #define USE_CURRENT_CONTEXT_IN_FILTER #endif // TARGET_X86 @@ -4902,6 +4906,9 @@ VOID DECLSPEC_NORETURN UnwindManagedExceptionPass1(PAL_SEHException& ex, CONTEXT LONG disposition = InternalUnhandledExceptionFilter_Worker(&ex.ExceptionPointers); _ASSERTE(disposition == EXCEPTION_CONTINUE_SEARCH); } +#if defined(TARGET_ANDROID) + __android_log_print (ANDROID_LOG_INFO, "CoreCLR", "End process at %s:%u", __FILE_NAME__, __LINE__); +#endif CrashDumpAndTerminateProcess(1); } else @@ -4961,6 +4968,9 @@ VOID DECLSPEC_NORETURN UnwindManagedExceptionPass1(PAL_SEHException& ex, CONTEXT LONG disposition = InternalUnhandledExceptionFilter_Worker(&ex.ExceptionPointers); _ASSERTE(disposition == EXCEPTION_CONTINUE_SEARCH); } +#if defined(TARGET_ANDROID) + __android_log_print (ANDROID_LOG_INFO, "CoreCLR", "End process at %s:%u", __FILE_NAME__, __LINE__); +#endif CrashDumpAndTerminateProcess(1); UNREACHABLE(); } @@ -5029,6 +5039,9 @@ VOID DECLSPEC_NORETURN DispatchManagedException(PAL_SEHException& ex, bool isHar // There are no managed frames on the stack, so the exception was not handled LONG disposition = InternalUnhandledExceptionFilter_Worker(&ex.ExceptionPointers); _ASSERTE(disposition == EXCEPTION_CONTINUE_SEARCH); +#if defined(TARGET_ANDROID) + __android_log_print (ANDROID_LOG_INFO, "CoreCLR", "End process at %s:%u", __FILE_NAME__, __LINE__); +#endif CrashDumpAndTerminateProcess(1); UNREACHABLE(); } @@ -5908,7 +5921,7 @@ void FixupDispatcherContext(DISPATCHER_CONTEXT* pDispatcherContext, CONTEXT* pCo } pDispatcherContext->ControlPc = (UINT_PTR) GetIP(pDispatcherContext->ContextRecord); - + #if defined(TARGET_ARM64) // Since this routine is used to fixup contexts for async exceptions, // clear the CONTEXT_UNWOUND_TO_CALL flag since, semantically, frames @@ -8496,6 +8509,9 @@ extern "C" bool QCALLTYPE SfiInit(StackFrameIterator* pThis, CONTEXT* pStackwalk GetThread()->SetThreadStateNC(Thread::TSNC_ProcessedUnhandledException); RaiseException(pExInfo->m_ExceptionCode, EXCEPTION_NONCONTINUABLE_EXCEPTION, pExInfo->m_ptrs.ExceptionRecord->NumberParameters, pExInfo->m_ptrs.ExceptionRecord->ExceptionInformation); #else +#if defined(TARGET_ANDROID) + __android_log_print (ANDROID_LOG_INFO, "CoreCLR", "End process at %s:%u", __FILE_NAME__, __LINE__); +#endif CrashDumpAndTerminateProcess(pExInfo->m_ExceptionCode); #endif } @@ -8615,6 +8631,9 @@ extern "C" bool QCALLTYPE SfiNext(StackFrameIterator* pThis, uint* uExCollideCla GetThread()->SetThreadStateNC(Thread::TSNC_ProcessedUnhandledException); RaiseException(pTopExInfo->m_ExceptionCode, EXCEPTION_NONCONTINUABLE_EXCEPTION, pTopExInfo->m_ptrs.ExceptionRecord->NumberParameters, pTopExInfo->m_ptrs.ExceptionRecord->ExceptionInformation); #else +#if defined(TARGET_ANDROID) + __android_log_print (ANDROID_LOG_INFO, "CoreCLR", "End process at %s:%u", __FILE_NAME__, __LINE__); +#endif CrashDumpAndTerminateProcess(pTopExInfo->m_ExceptionCode); #endif } diff --git a/src/coreclr/vm/jithelpers.cpp b/src/coreclr/vm/jithelpers.cpp index eeac550b3c0979..630ebfe42286fd 100644 --- a/src/coreclr/vm/jithelpers.cpp +++ b/src/coreclr/vm/jithelpers.cpp @@ -25,6 +25,10 @@ #include "dynamicinterfacecastable.h" #include "comsynchronizable.h" +#if defined(TARGET_ANDROID) +#include +#endif + #ifndef TARGET_UNIX // Included for referencing __report_gsfailure #include "process.h" @@ -2016,7 +2020,9 @@ void DoJITFailFast () COR_E_EXECUTIONENGINE, GetClrInstanceId()); } - +#if defined(TARGET_ANDROID) + __android_log_print (ANDROID_LOG_INFO, "CoreCLR", "End process at %s:%u", __FILE_NAME__, __LINE__); +#endif CrashDumpAndTerminateProcess(STATUS_STACK_BUFFER_OVERRUN); #endif // !TARGET_UNIX } diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.Stat.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.Stat.cs index 0796599a096497..d71009860ed4fd 100644 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.Stat.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.Stat.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Diagnostics; using System.Runtime.InteropServices; using Microsoft.Win32.SafeHandles; @@ -63,5 +64,15 @@ internal enum FileStatusFlags [LibraryImport(Libraries.SystemNative, EntryPoint = "SystemNative_LStat", StringMarshalling = StringMarshalling.Utf8, SetLastError = true)] internal static partial int LStat(string path, out FileStatus output); + + [LibraryImport("log", EntryPoint="__android_log_write", StringMarshalling = StringMarshalling.Utf8, SetLastError = false)] + static partial void AndroidLog (int prio, string tag, string message); + + internal static int LStatWrap(string path, out FileStatus output) + { + AndroidLog (4, "CoreCLR", $"LStat (\"{path}\""); + AndroidLog (4, "CoreCLR", new StackTrace (false).ToString ()); + return LStat (path, out output); + } } } diff --git a/src/libraries/System.Diagnostics.FileVersionInfo/src/System.Diagnostics.FileVersionInfo.csproj b/src/libraries/System.Diagnostics.FileVersionInfo/src/System.Diagnostics.FileVersionInfo.csproj index 230451074f3e08..9a726c5c8a68cb 100644 --- a/src/libraries/System.Diagnostics.FileVersionInfo/src/System.Diagnostics.FileVersionInfo.csproj +++ b/src/libraries/System.Diagnostics.FileVersionInfo/src/System.Diagnostics.FileVersionInfo.csproj @@ -57,6 +57,7 @@ + diff --git a/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj b/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj index 97e289045e324a..495e542701e4fd 100644 --- a/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj +++ b/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj @@ -387,6 +387,7 @@ + diff --git a/src/libraries/System.Formats.Tar/src/System.Formats.Tar.csproj b/src/libraries/System.Formats.Tar/src/System.Formats.Tar.csproj index 6f34a34cc6e7de..1f75915a9e59ff 100644 --- a/src/libraries/System.Formats.Tar/src/System.Formats.Tar.csproj +++ b/src/libraries/System.Formats.Tar/src/System.Formats.Tar.csproj @@ -79,6 +79,7 @@ + diff --git a/src/libraries/System.IO.Compression.ZipFile/src/System.IO.Compression.ZipFile.csproj b/src/libraries/System.IO.Compression.ZipFile/src/System.IO.Compression.ZipFile.csproj index 0613ab5e4848a0..d8ee616c411311 100644 --- a/src/libraries/System.IO.Compression.ZipFile/src/System.IO.Compression.ZipFile.csproj +++ b/src/libraries/System.IO.Compression.ZipFile/src/System.IO.Compression.ZipFile.csproj @@ -49,6 +49,7 @@ + diff --git a/src/libraries/System.IO.Compression/src/System.IO.Compression.csproj b/src/libraries/System.IO.Compression/src/System.IO.Compression.csproj index a744c58082b4c2..72aee5b6348079 100644 --- a/src/libraries/System.IO.Compression/src/System.IO.Compression.csproj +++ b/src/libraries/System.IO.Compression/src/System.IO.Compression.csproj @@ -78,6 +78,7 @@ + diff --git a/src/libraries/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj b/src/libraries/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj index 8544de48d095d5..ff372a63c7095a 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj +++ b/src/libraries/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj @@ -128,6 +128,7 @@ + diff --git a/src/libraries/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj b/src/libraries/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj index 1710a652f6d6e3..79b69e9b3fdab3 100644 --- a/src/libraries/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj +++ b/src/libraries/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj @@ -133,6 +133,7 @@ + diff --git a/src/libraries/System.IO.Pipes/src/System.IO.Pipes.csproj b/src/libraries/System.IO.Pipes/src/System.IO.Pipes.csproj index b36765a036839e..853f740f774499 100644 --- a/src/libraries/System.IO.Pipes/src/System.IO.Pipes.csproj +++ b/src/libraries/System.IO.Pipes/src/System.IO.Pipes.csproj @@ -194,6 +194,7 @@ + diff --git a/src/libraries/System.Net.Sockets/src/System.Net.Sockets.csproj b/src/libraries/System.Net.Sockets/src/System.Net.Sockets.csproj index 043fd6ecaba8ce..67bdf03186757a 100644 --- a/src/libraries/System.Net.Sockets/src/System.Net.Sockets.csproj +++ b/src/libraries/System.Net.Sockets/src/System.Net.Sockets.csproj @@ -316,6 +316,7 @@ + diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Exists.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Exists.Unix.cs index 172a956201dd86..8a96321d6b601c 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Exists.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Exists.Unix.cs @@ -46,7 +46,7 @@ private static bool FileExists(ReadOnlySpan fullPath, out Interop.ErrorInf // See http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap04.html#tag_04_11 for details. fullPath = Path.TrimEndingDirectorySeparator(fullPath); - if (Interop.Sys.LStat(fullPath, out fileinfo) < 0) + if (Interop.Sys.LStatWrap(fullPath.ToString (), out fileinfo) < 0) { errorInfo = Interop.Sys.GetLastErrorInfo(); return false; diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Unix.cs index 69ed0a6016adcf..9b7e2afc516bcd 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Unix.cs @@ -123,7 +123,7 @@ public static void ReplaceFile(string sourceFullPath, string destFullPath, strin { // Unix rename works in more cases, we limit to what is allowed by Windows File.Replace. // These checks are not atomic, the file could change after a check was performed and before it is renamed. - Interop.CheckIo(Interop.Sys.LStat(sourceFullPath, out Interop.Sys.FileStatus sourceStat), sourceFullPath); + Interop.CheckIo(Interop.Sys.LStatWrap(sourceFullPath, out Interop.Sys.FileStatus sourceStat), sourceFullPath); // Check source is not a directory. if ((sourceStat.Mode & Interop.Sys.FileTypes.S_IFMT) == Interop.Sys.FileTypes.S_IFDIR) @@ -132,7 +132,7 @@ public static void ReplaceFile(string sourceFullPath, string destFullPath, strin } Interop.Sys.FileStatus destStat; - if (Interop.Sys.LStat(destFullPath, out destStat) == 0) + if (Interop.Sys.LStatWrap(destFullPath, out destStat) == 0) { // Check destination is not a directory. if ((destStat.Mode & Interop.Sys.FileTypes.S_IFMT) == Interop.Sys.FileTypes.S_IFDIR) @@ -222,8 +222,8 @@ public static void MoveFile(string sourceFullPath, string destFullPath, bool ove // link/unlink approach and generating any exceptional messages from there as necessary. Interop.Sys.FileStatus sourceStat, destStat; - if (Interop.Sys.LStat(sourceFullPath, out sourceStat) == 0 && // source file exists - (Interop.Sys.LStat(destFullPath, out destStat) != 0 || // dest file does not exist + if (Interop.Sys.LStatWrap(sourceFullPath, out sourceStat) == 0 && // source file exists + (Interop.Sys.LStatWrap(destFullPath, out destStat) != 0 || // dest file does not exist (sourceStat.Dev == destStat.Dev && // source and dest are on the same device sourceStat.Ino == destStat.Ino)) && // source and dest are the same file on that device Interop.Sys.Rename(sourceFullPath, destFullPath) == 0) // try the rename @@ -411,12 +411,12 @@ private static void MoveDirectory(string sourceFullPath, string destFullPath, bo // The destination must not exist (unless it is a case-sensitive rename). // On Unix 'rename' will overwrite the destination file if it already exists, we need to manually check. - if (!isCaseSensitiveRename && Interop.Sys.LStat(destNoDirectorySeparator, out Interop.Sys.FileStatus destFileStatus) >= 0) + if (!isCaseSensitiveRename && Interop.Sys.LStatWrap(destNoDirectorySeparator.ToString (), out Interop.Sys.FileStatus destFileStatus) >= 0) { // Maintain order of exceptions as on Windows. // Throw if the source doesn't exist. - if (Interop.Sys.LStat(srcNoDirectorySeparator, out Interop.Sys.FileStatus sourceFileStatus) < 0) + if (Interop.Sys.LStatWrap(srcNoDirectorySeparator.ToString (), out Interop.Sys.FileStatus sourceFileStatus) < 0) { throw new DirectoryNotFoundException(SR.Format(SR.IO_PathNotFound_Path, sourceFullPath)); } diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.cs index 075a14d936c943..69c98d1713ca05 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.cs @@ -16,7 +16,7 @@ public static partial class Path // Checks if the given path is available for use. private static bool ExistsCore(string fullPath, out bool isDirectory) { - bool result = Interop.Sys.LStat(fullPath, out Interop.Sys.FileStatus fileInfo) == Interop.Errors.ERROR_SUCCESS; + bool result = Interop.Sys.LStatWrap(fullPath, out Interop.Sys.FileStatus fileInfo) == Interop.Errors.ERROR_SUCCESS; isDirectory = result && (fileInfo.Mode & Interop.Sys.FileTypes.S_IFMT) == Interop.Sys.FileTypes.S_IFDIR; return result; diff --git a/src/native/libs/Common/pal_error_common.h b/src/native/libs/Common/pal_error_common.h index 7541132da7b188..103e81c6e3efc1 100644 --- a/src/native/libs/Common/pal_error_common.h +++ b/src/native/libs/Common/pal_error_common.h @@ -145,6 +145,9 @@ typedef enum inline static int32_t ConvertErrorPlatformToPal(int32_t platformErrno) { +#if defined(TARGET_ANDROID) + __android_log_print (ANDROID_LOG_INFO, "CoreCLR", "%s at %s:%d. platformErrno == %d", __PRETTY_FUNCTION__, __FILE_NAME__, __LINE__, platformErrno); +#endif switch (platformErrno) { case 0: diff --git a/src/native/libs/System.IO.Ports.Native/CMakeLists.txt b/src/native/libs/System.IO.Ports.Native/CMakeLists.txt index a53be1dd8c9b7d..5a01ada023d589 100644 --- a/src/native/libs/System.IO.Ports.Native/CMakeLists.txt +++ b/src/native/libs/System.IO.Ports.Native/CMakeLists.txt @@ -22,6 +22,13 @@ if (GEN_SHARED_LIB) -lnetwork ) endif() + + if (CLR_CMAKE_TARGET_ANDROID) + target_link_libraries(System.IO.Ports.Native + PRIVATE + log + ) + endif() endif() add_library(System.IO.Ports.Native-Static diff --git a/src/native/libs/System.Native/pal_io.c b/src/native/libs/System.Native/pal_io.c index 3777ad55151f9d..b6f6198bf2b6ca 100644 --- a/src/native/libs/System.Native/pal_io.c +++ b/src/native/libs/System.Native/pal_io.c @@ -260,6 +260,9 @@ int32_t SystemNative_FStat(intptr_t fd, FileStatus* output) int32_t SystemNative_LStat(const char* path, FileStatus* output) { +#if defined(TARGET_ANDROID) + __android_log_print (ANDROID_LOG_INFO, "CoreCLR", "%s at %s:%d. path == '%s'", __PRETTY_FUNCTION__, __FILE_NAME__, __LINE__, path); +#endif struct stat_ result; int ret = lstat_(path, &result); @@ -399,7 +402,7 @@ int32_t SystemNative_IsMemfdSupported(void) } #endif - // Note that the name has no affect on file descriptor behavior. From linux manpage: + // Note that the name has no affect on file descriptor behavior. From linux manpage: // Names do not affect the behavior of the file descriptor, and as such multiple files can have the same name without any side effects. int32_t fd = (int32_t)syscall(__NR_memfd_create, "test", MFD_CLOEXEC | MFD_ALLOW_SEALING); if (fd < 0) return 0; @@ -1976,7 +1979,7 @@ static int GetAllowedVectorCount(IOVector* vectors, int32_t vectorCount) // For macOS preadv and pwritev can fail with EINVAL when the total length // of all vectors overflows a 32-bit integer. size_t totalLength = 0; - for (int i = 0; i < allowedCount; i++) + for (int i = 0; i < allowedCount; i++) { assert(INT_MAX >= vectors[i].Count);