diff options
author | Aditya Mandaleeka <adityam@microsoft.com> | 2015-10-22 23:49:43 -0700 |
---|---|---|
committer | Aditya Mandaleeka <adityam@microsoft.com> | 2015-10-26 17:38:36 -0700 |
commit | 483c6e304be6270e1b0be6b9620463c78b8bd44c (patch) | |
tree | aa918d4e1c742e2fd08687478d551b414283df9a /src/pal/src/cruntime | |
parent | 67737a56452fd69533bf61006db91c3b3a416a55 (diff) | |
download | coreclr-483c6e304be6270e1b0be6b9620463c78b8bd44c.tar.gz coreclr-483c6e304be6270e1b0be6b9620463c78b8bd44c.tar.bz2 coreclr-483c6e304be6270e1b0be6b9620463c78b8bd44c.zip |
Remove Enter/LeaveUnsafeRegion
Diffstat (limited to 'src/pal/src/cruntime')
-rw-r--r-- | src/pal/src/cruntime/filecrt.cpp | 29 | ||||
-rw-r--r-- | src/pal/src/cruntime/malloc.cpp | 8 | ||||
-rw-r--r-- | src/pal/src/cruntime/misc.cpp | 2 | ||||
-rw-r--r-- | src/pal/src/cruntime/printfcpp.cpp | 25 |
4 files changed, 14 insertions, 50 deletions
diff --git a/src/pal/src/cruntime/filecrt.cpp b/src/pal/src/cruntime/filecrt.cpp index 9c35178301..f7cc20f592 100644 --- a/src/pal/src/cruntime/filecrt.cpp +++ b/src/pal/src/cruntime/filecrt.cpp @@ -183,9 +183,7 @@ CorUnix::InternalFflush( ) { int nRet = 0; - pthrCurrent->suspensionInfo.EnterUnsafeRegion(); nRet = fflush(stream); - pthrCurrent->suspensionInfo.LeaveUnsafeRegion(); return nRet; } @@ -242,9 +240,7 @@ CorUnix::InternalGetcwd( if (szBuf == NULL) { // malloc is used to allocate space to store the pathname when szBuf is NULL. - pthrCurrent->suspensionInfo.EnterUnsafeRegion(); szBufCopy = (char *)getcwd(szBuf, nSize); - pthrCurrent->suspensionInfo.LeaveUnsafeRegion(); } else { @@ -297,13 +293,11 @@ CorUnix::InternalMkstemp( ) { int nRet = -1; - pthrCurrent->suspensionInfo.EnterUnsafeRegion(); #if MKSTEMP64_IS_USED_INSTEAD_OF_MKSTEMP nRet = mkstemp64(szNameTemplate); #else nRet = mkstemp(szNameTemplate); #endif - pthrCurrent->suspensionInfo.LeaveUnsafeRegion(); return nRet; } @@ -384,13 +378,11 @@ CorUnix::InternalOpen( va_end(ap); } - pthrCurrent->suspensionInfo.EnterUnsafeRegion(); #if OPEN64_IS_USED_INSTEAD_OF_OPEN nRet = open64(szPath, nFlags, mode); #else nRet = open(szPath, nFlags, mode); #endif - pthrCurrent->suspensionInfo.LeaveUnsafeRegion(); return nRet; } @@ -437,10 +429,8 @@ CorUnix::InternalUnlink( ) { int nRet = -1; - pthrCurrent->suspensionInfo.EnterUnsafeRegion(); nRet = unlink(szPath); - pthrCurrent->suspensionInfo.LeaveUnsafeRegion(); - return nRet; + return nRet; } @@ -465,14 +455,12 @@ CorUnix::InternalDeleteFile( ) { int nRet = -1; - pthrCurrent->suspensionInfo.EnterUnsafeRegion(); #if defined(__APPLE__) && defined(SYS_delete) nRet = syscall(SYS_delete, szPath); #else nRet = unlink(szPath); #endif // defined(__APPLE__) && defined(SYS_delete) - pthrCurrent->suspensionInfo.LeaveUnsafeRegion(); - return nRet; + return nRet; } @@ -524,9 +512,7 @@ CorUnix::InternalRename( ) { int nRet = -1; - pthrCurrent->suspensionInfo.EnterUnsafeRegion(); nRet = rename(szOldName, szNewName); - pthrCurrent->suspensionInfo.LeaveUnsafeRegion(); return nRet; } @@ -618,9 +604,7 @@ CorUnix::InternalFgets( do { - pthrCurrent->suspensionInfo.EnterUnsafeRegion(); retval = fgets(sz, nSize, f); - pthrCurrent->suspensionInfo.LeaveUnsafeRegion(); if (NULL==retval) { if (feof(f)) @@ -651,7 +635,7 @@ CorUnix::InternalFgets( } } } while(NULL == retval); - + return retval; } @@ -687,7 +671,7 @@ PAL_fwrite( _ASSERTE(pf != NULL); nWrittenBytes = InternalFwrite(InternalGetCurrentThread(), pvBuffer, nSize, nCount, pf->bsdFilePtr, &pf->PALferrorCode); - + LOGEXIT( "fwrite returning size_t %d\n", nWrittenBytes ); PERF_EXIT(fwrite); return nWrittenBytes; @@ -730,9 +714,7 @@ CorUnix::InternalFwrite( clearerr(f); #endif - pthrCurrent->suspensionInfo.EnterUnsafeRegion(); nWrittenBytes = fwrite(pvBuffer, nSize, nCount, f); - pthrCurrent->suspensionInfo.LeaveUnsafeRegion(); // Make sure no error ocurred. if ( nWrittenBytes < nCount ) @@ -808,9 +790,6 @@ CorUnix::InternalFseek( int nRet = -1; _ASSERTE(f != NULL); - pthrCurrent->suspensionInfo.EnterUnsafeRegion(); nRet = fseek(f, lOffset, nWhence); - pthrCurrent->suspensionInfo.LeaveUnsafeRegion(); return nRet; } - diff --git a/src/pal/src/cruntime/malloc.cpp b/src/pal/src/cruntime/malloc.cpp index 36587dbd81..665a027374 100644 --- a/src/pal/src/cruntime/malloc.cpp +++ b/src/pal/src/cruntime/malloc.cpp @@ -65,9 +65,7 @@ CorUnix::InternalRealloc( } else { - pthrCurrent->suspensionInfo.EnterUnsafeRegion(); pvMem = realloc(pvMemblock, szSize); - pthrCurrent->suspensionInfo.LeaveUnsafeRegion(); } LOGEXIT("realloc returns void * %p\n", pvMem); @@ -90,9 +88,7 @@ CorUnix::InternalFree( void *pvMem ) { - pthrCurrent->suspensionInfo.EnterUnsafeRegion(); free(pvMem); - pthrCurrent->suspensionInfo.LeaveUnsafeRegion(); } void * @@ -111,7 +107,6 @@ CorUnix::InternalMalloc( ) { void *pvMem; - pthrCurrent->suspensionInfo.EnterUnsafeRegion(); if (szSize == 0) { @@ -120,7 +115,6 @@ CorUnix::InternalMalloc( } pvMem = (void*)malloc(szSize); - pthrCurrent->suspensionInfo.LeaveUnsafeRegion(); return pvMem; } @@ -140,8 +134,6 @@ CorUnix::InternalStrdup( ) { char *pszStrCopy; - pthrCurrent->suspensionInfo.EnterUnsafeRegion(); pszStrCopy = strdup(c_szStr); - pthrCurrent->suspensionInfo.LeaveUnsafeRegion(); return pszStrCopy; } diff --git a/src/pal/src/cruntime/misc.cpp b/src/pal/src/cruntime/misc.cpp index fa8504f726..6451dd4898 100644 --- a/src/pal/src/cruntime/misc.cpp +++ b/src/pal/src/cruntime/misc.cpp @@ -63,9 +63,7 @@ namespace CorUnix ) { int nRet; - pthrCurrent->suspensionInfo.EnterUnsafeRegion(); nRet = rand(); - pthrCurrent->suspensionInfo.LeaveUnsafeRegion(); return nRet; } } diff --git a/src/pal/src/cruntime/printfcpp.cpp b/src/pal/src/cruntime/printfcpp.cpp index 8adf3470c2..cd66ad20fd 100644 --- a/src/pal/src/cruntime/printfcpp.cpp +++ b/src/pal/src/cruntime/printfcpp.cpp @@ -985,7 +985,7 @@ static INT Internal_AddPaddingVfwprintf(CPalThread *pthrCurrent, PAL_FILE *strea Length += Padding; } - int iLen = (Length+1); + int iLen = (Length+1); Out = (LPWSTR) InternalMalloc(pthrCurrent, iLen * sizeof(WCHAR)); if (!Out) { @@ -1146,18 +1146,14 @@ int CorUnix::InternalVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const int NativeVsnprintf(CPalThread *pthrCurrent, LPSTR Buffer, size_t Count, LPCSTR Format, va_list ap) { int retVal = 0; - pthrCurrent->suspensionInfo.EnterUnsafeRegion(); retVal = vsnprintf(Buffer, Count, Format, ap); - pthrCurrent->suspensionInfo.LeaveUnsafeRegion(); return retVal; } int NativeVfprintf(CPalThread *pthrCurrent, FILE *filePtr, const char *format, va_list ap) { int retVal = 0; - pthrCurrent->suspensionInfo.EnterUnsafeRegion(); retVal = vfprintf(filePtr, format, ap); - pthrCurrent->suspensionInfo.LeaveUnsafeRegion(); return retVal; } @@ -1296,7 +1292,7 @@ int CoreVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const wchar_16 *for } InternalFree(pthrCurrent, WorkingWStr); LOGEXIT("wcsncpy_s failed!\n"); - PERF_EXIT(vfwprintf); + PERF_EXIT(vfwprintf); va_end(ap); return (-1); } @@ -1325,7 +1321,7 @@ int CoreVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const wchar_16 *for } InternalFree(pthrCurrent, WorkingWStr); LOGEXIT("vfwprintf returns int -1\n"); - PERF_EXIT(vfwprintf); + PERF_EXIT(vfwprintf); va_end(ap); return (-1); } @@ -1433,7 +1429,7 @@ int CoreVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const wchar_16 *for ERROR("InternalMalloc failed\n"); LOGEXIT("vfwprintf returns int -1\n"); PERF_EXIT(vfwprintf); - pthrCurrent->SetLastError(ERROR_NOT_ENOUGH_MEMORY); + pthrCurrent->SetLastError(ERROR_NOT_ENOUGH_MEMORY); va_end(ap); return -1; } @@ -1461,7 +1457,7 @@ int CoreVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const wchar_16 *for ERROR("InternalMalloc failed\n"); LOGEXIT("vfwprintf returns int -1\n"); PERF_EXIT(vfwprintf); - pthrCurrent->SetLastError(ERROR_NOT_ENOUGH_MEMORY); + pthrCurrent->SetLastError(ERROR_NOT_ENOUGH_MEMORY); va_end(ap); return -1; } @@ -1486,7 +1482,7 @@ int CoreVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const wchar_16 *for ERROR("InternalMalloc failed\n"); LOGEXIT("vfwprintf returns int -1\n"); PERF_EXIT(vfwprintf); - pthrCurrent->SetLastError(ERROR_NOT_ENOUGH_MEMORY); + pthrCurrent->SetLastError(ERROR_NOT_ENOUGH_MEMORY); va_end(ap); return -1; } @@ -1511,7 +1507,7 @@ int CoreVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const wchar_16 *for InternalFree(pthrCurrent, TempSprintfStrPtr); } LOGEXIT("vfwprintf returns int -1\n"); - PERF_EXIT(vfwprintf); + PERF_EXIT(vfwprintf); va_end(ap); return -1; } @@ -1526,7 +1522,7 @@ int CoreVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const wchar_16 *for if(TempSprintfStrPtr) { InternalFree(pthrCurrent, TempSprintfStrPtr); - } + } va_end(ap); return -1; } @@ -1583,7 +1579,7 @@ int CoreVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const wchar_16 *for ++written; } } - + LOGEXIT("vfwprintf returns int %d\n", written); PERF_EXIT(vfwprintf); va_end(ap); @@ -2017,7 +2013,7 @@ int CoreWvsnprintf(CPalThread *pthrCurrent, LPWSTR Buffer, size_t Count, LPCWSTR } InternalFree(pthrCurrent, WorkingWStr); LOGEXIT("wcsncpy_s failed!\n"); - PERF_EXIT(wvsnprintf); + PERF_EXIT(wvsnprintf); va_end(ap); return (-1); } @@ -2563,4 +2559,3 @@ int CoreVfprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const char *format, PERF_EXIT(vfprintf); return written; } - |