Changeset 37818 in vbox
- Timestamp:
- Jul 7, 2011 1:25:03 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
include/iprt/log.h (modified) (1 diff)
-
include/iprt/mangling.h (modified) (1 diff)
-
src/VBox/Runtime/common/log/log.cpp (modified) (2 diffs)
-
src/VBox/VMM/VMMR3/VMM.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/log.h
r37591 r37818 1577 1577 1578 1578 /** 1579 * Flushes a R0 logger instance to a R3 logger. 1580 * 1581 * @returns iprt status code. 1582 * @param pLogger The R3 logger instance to flush pLoggerR0 to. If NULL 1583 * the default logger is used. 1584 * @param pLoggerR0 The R0 logger instance to flush. 1585 */ 1586 RTDECL(void) RTLogFlushR0(PRTLOGGER pLogger, PRTLOGGER pLoggerR0); 1587 1588 /** 1579 1589 * Sets the custom prefix callback. 1580 1590 * -
trunk/include/iprt/mangling.h
r37591 r37818 656 656 # define RTLogFlush RT_MANGLER(RTLogFlush) 657 657 # define RTLogFlushRC RT_MANGLER(RTLogFlushRC) 658 # define RTLogFlushR0 RT_MANGLER(RTLogFlushR0) 658 659 # define RTLogFlushToLogger RT_MANGLER(RTLogFlushToLogger) 659 660 # define RTLogFormatV RT_MANGLER(RTLogFormatV) -
trunk/src/VBox/Runtime/common/log/log.cpp
r37605 r37818 1060 1060 RT_EXPORT_SYMBOL(RTLogSetCustomPrefixCallbackForR0); 1061 1061 1062 RTDECL(void) RTLogFlushR0(PRTLOGGER pLogger, PRTLOGGER pLoggerR0) 1063 { 1064 /* 1065 * Resolve defaults. 1066 */ 1067 if (!pLogger) 1068 { 1069 pLogger = RTLogDefaultInstance(); 1070 if (!pLogger) 1071 { 1072 /* flushing to "/dev/null". */ 1073 if (pLoggerR0->offScratch) 1074 pLoggerR0->offScratch = 0; 1075 return; 1076 } 1077 } 1078 1079 /* 1080 * Any thing to flush? 1081 */ 1082 if ( pLoggerR0->offScratch 1083 || pLogger->offScratch) 1084 { 1085 /* 1086 * Acquire logger semaphores. 1087 */ 1088 int rc = rtlogLock(pLogger); 1089 if (RT_FAILURE(rc)) 1090 return; 1091 if (RT_SUCCESS(rc)) 1092 { 1093 /* 1094 * Write whatever the GC instance contains to the HC one, and then 1095 * flush the HC instance. 1096 */ 1097 if (pLoggerR0->offScratch) 1098 { 1099 rtLogOutput(pLogger, pLoggerR0->achScratch, pLoggerR0->offScratch); 1100 rtLogOutput(pLogger, NULL, 0); 1101 pLoggerR0->offScratch = 0; 1102 } 1103 } 1104 rtlogUnlock(pLogger); 1105 } 1106 } 1107 RT_EXPORT_SYMBOL(RTLogFlushR0); 1108 1062 1109 # endif /* IN_RING3 */ 1063 1110 … … 1089 1136 { 1090 1137 pSrcLogger->offScratch = 0; 1091 rtlog Lock(pSrcLogger);1138 rtlogUnlock(pSrcLogger); 1092 1139 } 1093 1140 } -
trunk/src/VBox/VMM/VMMR3/VMM.cpp
r37699 r37818 884 884 * in ring-0. Only initialize it once. 885 885 */ 886 PRTLOGGER const pDefault = RTLog RelDefaultInstance();886 PRTLOGGER const pDefault = RTLogDefaultInstance(); 887 887 for (VMCPUID i = 0; i < pVM->cCpus; i++) 888 888 { … … 901 901 AssertReleaseMsgRCReturn(rc, ("vmmR0LoggerFlush not found! rc=%Rra\n", rc), rc); 902 902 903 rc = RTLogCreateForR0(&pR0LoggerR3->Logger, pR0LoggerR3->cbLogger, pVCpu->vmm.s.pR0LoggerR0 ,903 rc = RTLogCreateForR0(&pR0LoggerR3->Logger, pR0LoggerR3->cbLogger, pVCpu->vmm.s.pR0LoggerR0 + RT_OFFSETOF(VMMR0LOGGER, Logger), 904 904 pfnLoggerWrapper, pfnLoggerFlush, 905 905 RTLOGFLAGS_BUFFERED, RTLOGDEST_DUMMY); … … 909 909 rc = PDMR3LdrGetSymbolR0(pVM, VMMR0_MAIN_MODULE_NAME, "vmmR0LoggerPrefix", &pfnLoggerPrefix); 910 910 AssertReleaseMsgRCReturn(rc, ("vmmR0LoggerPrefix not found! rc=%Rra\n", rc), rc); 911 rc = RTLogSetCustomPrefixCallbackForR0(&pR0LoggerR3->Logger, pVCpu->vmm.s.pR0LoggerR0 , pfnLoggerPrefix, NIL_RTR0PTR);911 rc = RTLogSetCustomPrefixCallbackForR0(&pR0LoggerR3->Logger, pVCpu->vmm.s.pR0LoggerR0 + RT_OFFSETOF(VMMR0LOGGER, Logger), pfnLoggerPrefix, NIL_RTR0PTR); 912 912 AssertReleaseMsgRCReturn(rc, ("RTLogSetCustomPrefixCallback failed! rc=%Rra\n", rc), rc); 913 913 … … 918 918 } 919 919 920 rc = RTLogCopyGroupsAndFlagsForR0(&pR0LoggerR3->Logger, pVCpu->vmm.s.pR0LoggerR0 , pDefault,921 UINT32_MAX, RTLOGFLAGS_BUFFERED);920 rc = RTLogCopyGroupsAndFlagsForR0(&pR0LoggerR3->Logger, pVCpu->vmm.s.pR0LoggerR0 + RT_OFFSETOF(VMMR0LOGGER, Logger), pDefault, 921 RTLOGFLAGS_BUFFERED, UINT32_MAX); 922 922 AssertRC(rc); 923 923 } … … 1293 1293 if ( pR0LoggerR3 1294 1294 && pR0LoggerR3->Logger.offScratch > 0) 1295 RTLogFlush ToLogger(&pR0LoggerR3->Logger, NULL);1295 RTLogFlushR0(NULL, &pR0LoggerR3->Logger); 1296 1296 #endif /* !LOG_ENABLED */ 1297 1297 if (rc != VINF_VMM_CALL_HOST) … … 1980 1980 if ( pVCpu->vmm.s.pR0LoggerR3 1981 1981 && pVCpu->vmm.s.pR0LoggerR3->Logger.offScratch > 0) 1982 RTLogFlush ToLogger(&pVCpu->vmm.s.pR0LoggerR3->Logger, NULL);1982 RTLogFlushR0(NULL, &pVCpu->vmm.s.pR0LoggerR3->Logger); 1983 1983 #endif 1984 1984 if (rc != VINF_VMM_CALL_HOST)
Note:
See TracChangeset
for help on using the changeset viewer.

