diff options
author | Aditya Mandaleeka <adityamandaleeka@users.noreply.github.com> | 2015-11-06 12:52:30 -0800 |
---|---|---|
committer | Aditya Mandaleeka <adityamandaleeka@users.noreply.github.com> | 2015-11-06 12:52:30 -0800 |
commit | 9e8d9ee39b014a2969f9d52bfb8d9d7da2440b5f (patch) | |
tree | 01b82cd4a5a6005e67a894c052385c7232545625 | |
parent | db7b09965a4e6dc64130a7086eaf9f5258c85c82 (diff) | |
parent | 4b813ed22376943953361a8e5ca7f642c53db22d (diff) | |
download | coreclr-9e8d9ee39b014a2969f9d52bfb8d9d7da2440b5f.tar.gz coreclr-9e8d9ee39b014a2969f9d52bfb8d9d7da2440b5f.tar.bz2 coreclr-9e8d9ee39b014a2969f9d52bfb8d9d7da2440b5f.zip |
Merge pull request #1959 from adityamandaleeka/remove_suspension
Remove thread parameter from a few more places in PAL
-rw-r--r-- | src/pal/src/cruntime/printfcpp.cpp | 29 | ||||
-rw-r--r-- | src/pal/src/file/file.cpp | 15 | ||||
-rw-r--r-- | src/pal/src/file/shmfilelockmgr.cpp | 13 | ||||
-rw-r--r-- | src/pal/src/file/shmfilelockmgr.hpp | 14 | ||||
-rw-r--r-- | src/pal/src/include/pal/corunix.hpp | 28 | ||||
-rw-r--r-- | src/pal/src/init/pal.cpp | 14 | ||||
-rw-r--r-- | src/pal/src/map/virtual.cpp | 24 | ||||
-rw-r--r-- | src/pal/src/misc/strutil.cpp | 54 | ||||
-rw-r--r-- | src/pal/src/objmgr/palobjbase.cpp | 2 |
9 files changed, 47 insertions, 146 deletions
diff --git a/src/pal/src/cruntime/printfcpp.cpp b/src/pal/src/cruntime/printfcpp.cpp index 24a12d3e95..a05df0cdaf 100644 --- a/src/pal/src/cruntime/printfcpp.cpp +++ b/src/pal/src/cruntime/printfcpp.cpp @@ -104,8 +104,8 @@ static int Internal_Convertfwrite(CPalThread *pthrCurrent, const void *buffer, s } return ret; -} - +} + /******************************************************************************* Function: Internal_ExtractFormatA @@ -979,7 +979,6 @@ static INT Internal_AddPaddingVfwprintf(CPalThread *pthrCurrent, PAL_FILE *strea LengthInStr = PAL_wcslen(In); Length = LengthInStr; - if (Padding > 0) { Length += Padding; @@ -1143,20 +1142,6 @@ int CorUnix::InternalVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const return CoreVfwprintf(pthrCurrent, stream, format, ap); } -int NativeVsnprintf(CPalThread *pthrCurrent, LPSTR Buffer, size_t Count, LPCSTR Format, va_list ap) -{ - int retVal = 0; - retVal = vsnprintf(Buffer, Count, Format, ap); - return retVal; -} - -int NativeVfprintf(CPalThread *pthrCurrent, FILE *filePtr, const char *format, va_list ap) -{ - int retVal = 0; - retVal = vfprintf(filePtr, format, ap); - return retVal; -} - int CoreVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const wchar_16 *format, va_list aparg) { CHAR TempBuff[1024]; /* used to hold a single %<foo> format string */ @@ -1471,7 +1456,7 @@ int CoreVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const wchar_16 *for va_list apcopy; va_copy(apcopy, ap); - TempInt = NativeVsnprintf(pthrCurrent, TempSprintfStr, TEMP_COUNT, TempBuff, apcopy); + TempInt = vsnprintf(TempSprintfStr, TEMP_COUNT, TempBuff, apcopy); va_end(apcopy); PAL_printf_arg_remover(&ap, Width, Precision, Type, Prefix); @@ -1489,7 +1474,7 @@ int CoreVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const wchar_16 *for TempSprintfStr = TempSprintfStrPtr; va_copy(apcopy, ap); - NativeVsnprintf(pthrCurrent, TempSprintfStr, TempInt, TempBuff, apcopy); + vsnprintf(TempSprintfStr, TempInt, TempBuff, apcopy); va_end(apcopy); PAL_printf_arg_remover(&ap, Width, Precision, Type, Prefix); } @@ -1841,7 +1826,7 @@ int CoreVsnprintf(CPalThread *pthrCurrent, LPSTR Buffer, size_t Count, LPCSTR Fo { va_list apcopy; va_copy(apcopy, ap); - TempInt = NativeVsnprintf(pthrCurrent, BufferPtr, TempCount, TempBuff, apcopy); + TempInt = vsnprintf(BufferPtr, TempCount, TempBuff, apcopy); va_end(apcopy); PAL_printf_arg_remover(&ap, Width, Precision, Type, Prefix); } @@ -2139,7 +2124,7 @@ int CoreWvsnprintf(CPalThread *pthrCurrent, LPWSTR Buffer, size_t Count, LPCWSTR { va_list apcopy; va_copy(apcopy, ap); - TempInt = NativeVsnprintf(pthrCurrent, (LPSTR) BufferPtr, TempCount, TempBuff, apcopy); + TempInt = vsnprintf((LPSTR) BufferPtr, TempCount, TempBuff, apcopy); va_end(apcopy); PAL_printf_arg_remover(&ap, Width, Precision, Type, Prefix); } @@ -2520,7 +2505,7 @@ int CoreVfprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const char *format, { va_list apcopy; va_copy(apcopy, ap); - TempInt = NativeVfprintf(pthrCurrent, stream->bsdFilePtr, TempBuff, apcopy); + TempInt = vfprintf(stream->bsdFilePtr, TempBuff, apcopy); va_end(apcopy); PAL_printf_arg_remover(&ap, Width, Precision, Type, Prefix); } diff --git a/src/pal/src/file/file.cpp b/src/pal/src/file/file.cpp index 315687366f..352a0979b1 100644 --- a/src/pal/src/file/file.cpp +++ b/src/pal/src/file/file.cpp @@ -113,7 +113,7 @@ FileCleanupRoutine( if (pLocalData->pLockController != NULL) { - pLocalData->pLockController->ReleaseController(pThread); + pLocalData->pLockController->ReleaseController(); } if (!fShutdown && -1 != pLocalData->unix_fd) @@ -852,7 +852,7 @@ done: if (NULL != pLockController) { - pLockController->ReleaseController(pThread); + pLockController->ReleaseController(); } if (NULL != pDataLock) @@ -1228,9 +1228,8 @@ DeleteFileA( } } - palError = g_pFileLockManager->GetFileShareModeForFile(pThread, - lpFullUnixFileName, - &dwShareMode); + palError = g_pFileLockManager->GetFileShareModeForFile(lpFullUnixFileName, &dwShareMode); + // Use unlink if we succesfully found the file to be opened with // a FILE_SHARE_DELETE mode. // Note that there is a window here where a race condition can occur: @@ -2214,7 +2213,7 @@ done: if (NULL != pTransactionLock) { - pTransactionLock->ReleaseLock(pThread); + pTransactionLock->ReleaseLock(); } if (NULL != pLocalDataLock) @@ -2439,7 +2438,7 @@ done: if (NULL != pTransactionLock) { - pTransactionLock->ReleaseLock(pThread); + pTransactionLock->ReleaseLock(); } if (NULL != pLocalDataLock) @@ -4843,7 +4842,7 @@ done: if (NULL != pLockController) { - pLockController->ReleaseController(pThread); + pLockController->ReleaseController(); } if (NULL != pDataLock) diff --git a/src/pal/src/file/shmfilelockmgr.cpp b/src/pal/src/file/shmfilelockmgr.cpp index 571f5e950d..8872ef1900 100644 --- a/src/pal/src/file/shmfilelockmgr.cpp +++ b/src/pal/src/file/shmfilelockmgr.cpp @@ -245,7 +245,7 @@ GetLockControllerForFileExit: { if (NULL != pController) { - pController->ReleaseController(pThread); + pController->ReleaseController(); } if (SHMNULL != shmFileLocks) @@ -265,7 +265,6 @@ GetLockControllerForFileExit: PAL_ERROR CSharedMemoryFileLockMgr::GetFileShareModeForFile( - CPalThread *pThread, LPCSTR szFileName, DWORD* pdwShareMode) { @@ -274,7 +273,6 @@ CSharedMemoryFileLockMgr::GetFileShareModeForFile( SHMPTR shmFileLocks = SHMNULL; SHMFILELOCKS* fileLocks = NULL; - SHMLock(); palError = FILEGetSHMFileLocks(szFileName, &shmFileLocks, TRUE); @@ -306,7 +304,6 @@ GetLockControllerForFileExit: SHMRelease(); return palError; - } PAL_ERROR @@ -427,9 +424,7 @@ CSharedMemoryFileLockController::ReleaseFileLock( } void -CSharedMemoryFileLockController::ReleaseController( - CPalThread *pThread // IN, OPTIONAL - ) +CSharedMemoryFileLockController::ReleaseController() { if (SHMNULL != m_shmFileLocks) { @@ -444,9 +439,7 @@ CSharedMemoryFileLockController::ReleaseController( } void -CSharedMemoryFileTransactionLock::ReleaseLock( - CPalThread *pThread - ) +CSharedMemoryFileTransactionLock::ReleaseLock() { FILEUnlockFileRegion( m_shmFileLocks, diff --git a/src/pal/src/file/shmfilelockmgr.hpp b/src/pal/src/file/shmfilelockmgr.hpp index 0a2c1342dc..a3d0e3acd8 100644 --- a/src/pal/src/file/shmfilelockmgr.hpp +++ b/src/pal/src/file/shmfilelockmgr.hpp @@ -74,10 +74,10 @@ namespace CorUnix DWORD dwShareMode, IFileLockController **ppLockController // OUT ); + virtual - PAL_ERROR - GetFileShareModeForFile( - CPalThread *pThread, + PAL_ERROR + GetFileShareModeForFile( LPCSTR szFileName, DWORD* pdwShareMode); }; @@ -142,9 +142,7 @@ namespace CorUnix virtual void - ReleaseController( - CPalThread *pThread // IN, OPTIONAL - ); + ReleaseController(); }; class CSharedMemoryFileTransactionLock : public IFileTransactionLock @@ -180,9 +178,7 @@ namespace CorUnix virtual void - ReleaseLock( - CPalThread *pThread // IN, OPTIONAL - ); + ReleaseLock(); }; } diff --git a/src/pal/src/include/pal/corunix.hpp b/src/pal/src/include/pal/corunix.hpp index e7781990d3..96a8d682a6 100644 --- a/src/pal/src/include/pal/corunix.hpp +++ b/src/pal/src/include/pal/corunix.hpp @@ -103,7 +103,6 @@ namespace CorUnix PAL_ERROR CopyString( - CPalThread *pthr, CPalString *psSource ); @@ -1240,9 +1239,7 @@ namespace CorUnix virtual void - ReleaseLock( - CPalThread *pThread // IN, OPTIONAL - ) = 0; + ReleaseLock() = 0; }; class IFileLockController @@ -1317,10 +1314,7 @@ namespace CorUnix virtual void - ReleaseController( - CPalThread *pThread // IN, OPTIONAL - ) = 0; - + ReleaseController() = 0; }; class IFileLockManager @@ -1350,27 +1344,13 @@ namespace CorUnix // not found) // virtual - PAL_ERROR - GetFileShareModeForFile( - CPalThread *pThread, + PAL_ERROR + GetFileShareModeForFile( LPCSTR szFileName, DWORD* pdwShareMode) = 0; }; extern IFileLockManager *g_pFileLockManager; - - // - // Utility function for converting sz object names to wsz - // - - PAL_ERROR - InternalWszNameFromSzName( - CPalThread *pthr, - LPCSTR pszName, - LPWSTR pwszName, - DWORD cch - ); - } #endif // _CORUNIX_H diff --git a/src/pal/src/init/pal.cpp b/src/pal/src/init/pal.cpp index 9b7de99601..00ce8148da 100644 --- a/src/pal/src/init/pal.cpp +++ b/src/pal/src/init/pal.cpp @@ -95,8 +95,8 @@ static PCRITICAL_SECTION init_critsec = NULL; static int Initialize(int argc, const char *const argv[], DWORD flags); static BOOL INIT_IncreaseDescriptorLimit(void); -static LPWSTR INIT_FormatCommandLine (CPalThread *pThread, int argc, const char * const *argv); -static LPWSTR INIT_FindEXEPath(CPalThread *pThread, LPCSTR exe_name); +static LPWSTR INIT_FormatCommandLine (int argc, const char * const *argv); +static LPWSTR INIT_FindEXEPath(LPCSTR exe_name); #ifdef _DEBUG extern void PROCDumpThreadList(void); @@ -397,7 +397,7 @@ Initialize( if (argc > 0 && argv != NULL) { /* build the command line */ - command_line = INIT_FormatCommandLine(pThread, argc, argv); + command_line = INIT_FormatCommandLine(argc, argv); if (NULL == command_line) { ERROR("Error building command line\n"); @@ -405,7 +405,7 @@ Initialize( } /* find out the application's full path */ - exe_path = INIT_FindEXEPath(pThread, argv[0]); + exe_path = INIT_FindEXEPath(argv[0]); if (NULL == exe_path) { ERROR("Unable to find exe path\n"); @@ -998,7 +998,7 @@ Note : not all peculiarities of Windows command-line processing are supported; passed to argv as \\a... there may be other similar cases -there may be other characters which must be escaped --*/ -static LPWSTR INIT_FormatCommandLine (CPalThread *pThread, int argc, const char * const *argv) +static LPWSTR INIT_FormatCommandLine (int argc, const char * const *argv) { LPWSTR retval; LPSTR command_line=NULL, command_ptr; @@ -1032,7 +1032,7 @@ static LPWSTR INIT_FormatCommandLine (CPalThread *pThread, int argc, const char command_ptr=command_line; for(i=0; i<argc; i++) { - /* double-quote at beginning of argument containing at leat one space */ + /* double-quote at beginning of argument containing at least one space */ for(j = 0; (argv[i][j] != 0) && (!isspace((unsigned char) argv[i][j])); j++); if (argv[i][j] != 0) @@ -1116,7 +1116,7 @@ Notes 2: This doesn't handle the case of directories with the desired name (and directories are usually executable...) --*/ -static LPWSTR INIT_FindEXEPath(CPalThread *pThread, LPCSTR exe_name) +static LPWSTR INIT_FindEXEPath(LPCSTR exe_name) { #ifndef __APPLE__ CHAR real_path[PATH_MAX+1]; diff --git a/src/pal/src/map/virtual.cpp b/src/pal/src/map/virtual.cpp index 1e38526eb4..0a9e773d0d 100644 --- a/src/pal/src/map/virtual.cpp +++ b/src/pal/src/map/virtual.cpp @@ -67,8 +67,8 @@ static FREE_BLOCK *pFreeMemory; // Currently 1GB. static const int BACKING_FILE_SIZE = 1024 * 1024 * 1024; -static void *VIRTUALReserveFromBackingFile(CPalThread *pthrCurrnet, UINT_PTR addr, size_t length); -static BOOL VIRTUALAddToFreeList(CPalThread* pthrCurrent, const PCMI pMemoryToBeReleased); +static void *VIRTUALReserveFromBackingFile(UINT_PTR addr, size_t length); +static BOOL VIRTUALAddToFreeList(const PCMI pMemoryToBeReleased); // The base address of the pages mapped onto our backing file. static void *gBackingBaseAddress = MAP_FAILED; @@ -565,7 +565,7 @@ Function : Returns true on success. FALSE otherwise. --*/ -static BOOL VIRTUALReleaseMemory( CPalThread *pthrCurrent, PCMI pMemoryToBeReleased ) +static BOOL VIRTUALReleaseMemory( PCMI pMemoryToBeReleased ) { BOOL bRetVal = TRUE; @@ -575,7 +575,6 @@ static BOOL VIRTUALReleaseMemory( CPalThread *pthrCurrent, PCMI pMemoryToBeRelea return FALSE; } - if ( pMemoryToBeReleased == pVirtualMemory ) { /* This is either the first entry, or the only entry. */ @@ -602,7 +601,7 @@ static BOOL VIRTUALReleaseMemory( CPalThread *pthrCurrent, PCMI pMemoryToBeRelea #if MMAP_IGNORES_HINT // We've removed the block from our allocated list. Add it to the // free list. - bRetVal = VIRTUALAddToFreeList(pthrCurrent, pMemoryToBeReleased); + bRetVal = VIRTUALAddToFreeList(pMemoryToBeReleased); #endif // MMAP_IGNORES_HINT InternalFree( pMemoryToBeReleased->pAllocState ); @@ -759,7 +758,6 @@ static void VIRTUALDisplayList( void ) * NOTE: The caller must own the critical section. */ static BOOL VIRTUALStoreAllocationInfo( - IN CPalThread *pthrCurrent, /* Currently executing thread */ IN UINT_PTR startBoundary, /* Start of the region. */ IN SIZE_T memSize, /* Size of the region. */ IN DWORD flAllocationType, /* Allocation Types. */ @@ -913,7 +911,7 @@ static LPVOID VIRTUALReserveMemory( InternalEnterCriticalSection(pthrCurrent, &virtual_critsec); #if MMAP_IGNORES_HINT - pRetVal = VIRTUALReserveFromBackingFile(pthrCurrent, StartBoundary, MemSize); + pRetVal = VIRTUALReserveFromBackingFile(StartBoundary, MemSize); #else // MMAP_IGNORES_HINT // Most platforms will only commit the memory if it is dirtied, // so this should not consume too much swap space. @@ -980,7 +978,7 @@ static LPVOID VIRTUALReserveMemory( #if !MMAP_IGNORES_HINT } #endif // MMAP_IGNORES_HINT - if ( !VIRTUALStoreAllocationInfo( pthrCurrent, StartBoundary, MemSize, + if ( !VIRTUALStoreAllocationInfo( StartBoundary, MemSize, flAllocationType, flProtect ) ) { ASSERT( "Unable to store the structure in the list.\n"); @@ -1219,7 +1217,7 @@ error: #else // MMAP_IGNORES_HINT && !MMAP_DOESNOT_ALLOW_REMAP munmap( pRetVal, MemSize ); #endif // MMAP_IGNORES_HINT && !MMAP_DOESNOT_ALLOW_REMAP - if ( VIRTUALReleaseMemory( pthrCurrent, pInformation ) == FALSE ) + if ( VIRTUALReleaseMemory( pInformation ) == FALSE ) { ASSERT( "Unable to remove the PCMI entry from the list.\n" ); pthrCurrent->SetLastError( ERROR_INTERNAL_ERROR ); @@ -1260,7 +1258,7 @@ Function: Returns the base address of the mapped block, or MAP_FAILED if no suitable block exists or mapping fails. --*/ -static void *VIRTUALReserveFromBackingFile(CPalThread *pthrCurrent, UINT_PTR addr, size_t length) +static void *VIRTUALReserveFromBackingFile(UINT_PTR addr, size_t length) { FREE_BLOCK *block; FREE_BLOCK *prev; @@ -1366,7 +1364,7 @@ Function: Returns TRUE if the block was added to the free list. --*/ -static BOOL VIRTUALAddToFreeList(CPalThread* pthrCurrent, const PCMI pMemoryToBeReleased) +static BOOL VIRTUALAddToFreeList(const PCMI pMemoryToBeReleased) { FREE_BLOCK *temp; FREE_BLOCK *lastBlock; @@ -1505,7 +1503,7 @@ static BOOL VIRTUALGetBackingFile(CPalThread *pthrCurrent) ASSERT("Surprisingly, LibRotorPal can't be found!"); goto done; } - gBackingFile = InternalOpen(pthrCurrent, palName, O_RDONLY); + gBackingFile = InternalOpen(palName, O_RDONLY); if (gBackingFile == -1) { ASSERT("Failed to open %s as a backing file: errno=%d\n", @@ -1824,7 +1822,7 @@ VirtualFree( pMemoryToBeReleased->memSize ) == 0 ) #endif // MMAP_IGNORES_HINT && !MMAP_DOESNOT_ALLOW_REMAP { - if ( VIRTUALReleaseMemory( pthrCurrent, pMemoryToBeReleased ) == FALSE ) + if ( VIRTUALReleaseMemory( pMemoryToBeReleased ) == FALSE ) { ASSERT( "Unable to remove the PCMI entry from the list.\n" ); pthrCurrent->SetLastError( ERROR_INTERNAL_ERROR ); diff --git a/src/pal/src/misc/strutil.cpp b/src/pal/src/misc/strutil.cpp index ddeef0680d..e0f2cb25f2 100644 --- a/src/pal/src/misc/strutil.cpp +++ b/src/pal/src/misc/strutil.cpp @@ -35,13 +35,11 @@ Function: as necessary Parameters: - pthr -- thread data for calling thread psSource -- the string to copy from --*/ PAL_ERROR CPalString::CopyString( - CPalThread *pthr, CPalString *psSource ) { @@ -50,7 +48,7 @@ CPalString::CopyString( _ASSERTE(NULL != psSource); _ASSERTE(NULL == m_pwsz); _ASSERTE(0 == m_dwStringLength); - _ASSERTE(0 == m_dwMaxLength); + _ASSERTE(0 == m_dwMaxLength); if (0 != psSource->GetStringLength()) { @@ -63,7 +61,7 @@ CPalString::CopyString( if (NULL != pwsz) { _ASSERTE(NULL != psSource->GetString()); - + CopyMemory( pwsz, psSource->GetString(), @@ -102,51 +100,3 @@ CPalString::FreeBuffer( InternalFree(const_cast<WCHAR*>(m_pwsz)); } - -/*++ -Function: - InternalWszNameFromSzName - - Helper function to convert an ANSI string object name parameter to a - unicode string - -Parameters: - pthr -- thread data for calling thread - pszName -- the ANSI string name - pwszName -- on success, receives the converted unicode string - cch -- the size of pwszName, in characters ---*/ - -PAL_ERROR -CorUnix::InternalWszNameFromSzName( - CPalThread *pthr, - LPCSTR pszName, - LPWSTR pwszName, - DWORD cch - ) -{ - PAL_ERROR palError = NO_ERROR; - - _ASSERTE(NULL != pthr); - _ASSERTE(NULL != pszName); - _ASSERTE(NULL != pwszName); - _ASSERTE(0 < cch); - - if (MultiByteToWideChar(CP_ACP, 0, pszName, -1, pwszName, cch) == 0) - { - palError = pthr->GetLastError(); - if (ERROR_INSUFFICIENT_BUFFER == palError) - { - ERROR("pszName is larger than cch (%d)!\n", palError); - palError = ERROR_FILENAME_EXCED_RANGE; - } - else - { - ERROR("MultiByteToWideChar failure! (error=%d)\n", palError); - palError = ERROR_INVALID_PARAMETER; - } - } - - return palError; -} - diff --git a/src/pal/src/objmgr/palobjbase.cpp b/src/pal/src/objmgr/palobjbase.cpp index a75a974c78..63e0f866d6 100644 --- a/src/pal/src/objmgr/palobjbase.cpp +++ b/src/pal/src/objmgr/palobjbase.cpp @@ -97,7 +97,7 @@ CPalObjectBase::Initialize( if (0 != poa->sObjectName.GetStringLength()) { - palError = m_oa.sObjectName.CopyString(pthr, &poa->sObjectName); + palError = m_oa.sObjectName.CopyString(&poa->sObjectName); } IntializeExit: |