Changeset 49938 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Dec 16, 2013 5:13:59 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/log/log.cpp
r48935 r49938 293 293 { "user", sizeof("user" ) - 1, RTLOGDEST_USER }, 294 294 }; 295 296 /** 297 * Log rotation backoff table, important on Windows host, especially for 298 * VBoxSVC release logging. Only a medium term solution, until a proper fix 299 * for log file handling is available. 10 seconds total. 300 */ 301 static const uint32_t s_aLogBackoff[] = 302 { 10, 10, 10, 20, 50, 100, 200, 200, 200, 200, 500, 500, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000 }; 295 303 296 304 … … 2610 2618 static int rtlogFileOpen(PRTLOGGER pLogger, char *pszErrorMsg, size_t cchErrorMsg) 2611 2619 { 2612 uint32_t fOpen = RTFILE_O_WRITE | RTFILE_O_DENY_ WRITE;2620 uint32_t fOpen = RTFILE_O_WRITE | RTFILE_O_DENY_NONE; 2613 2621 if (pLogger->fFlags & RTLOGFLAGS_APPEND) 2614 2622 fOpen |= RTFILE_O_OPEN_CREATE | RTFILE_O_APPEND; … … 2618 2626 fOpen |= RTFILE_O_WRITE_THROUGH; 2619 2627 2620 int rc = RTFileOpen(&pLogger->pInt->hFile, pLogger->pInt->szFilename, fOpen); 2628 int rc; 2629 int cBackoff = 0; 2630 do 2631 { 2632 rc = RTFileOpen(&pLogger->pInt->hFile, pLogger->pInt->szFilename, fOpen); 2633 if (rc == VERR_SHARING_VIOLATION) 2634 { 2635 if (cBackoff >= RT_ELEMENTS(s_aLogBackoff)) 2636 break; 2637 RTThreadSleep(s_aLogBackoff[cBackoff]); 2638 cBackoff++; 2639 } 2640 } 2641 while (rc == VERR_SHARING_VIOLATION); 2621 2642 if (RT_FAILURE(rc)) 2622 2643 { … … 2710 2731 char szNewName[sizeof(pLogger->pInt->szFilename) + 32]; 2711 2732 RTStrPrintf(szNewName, sizeof(szNewName), "%s.%u", pLogger->pInt->szFilename, i + 1); 2712 if ( RTFileRename(szOldName, szNewName, RTFILEMOVE_FLAGS_REPLACE) 2713 == VERR_FILE_NOT_FOUND) 2733 2734 2735 2736 int rc; 2737 int cBackoff = 0; 2738 do 2739 { 2740 rc = RTFileRename(szOldName, szNewName, RTFILEMOVE_FLAGS_REPLACE); 2741 if (rc == VERR_SHARING_VIOLATION) 2742 { 2743 if (cBackoff >= RT_ELEMENTS(s_aLogBackoff)) 2744 break; 2745 RTThreadSleep(s_aLogBackoff[cBackoff]); 2746 cBackoff++; 2747 } 2748 } 2749 while (rc == VERR_SHARING_VIOLATION); 2750 if (rc == VERR_FILE_NOT_FOUND) 2714 2751 RTFileDelete(szNewName); 2715 2752 }
Note:
See TracChangeset
for help on using the changeset viewer.