VirtualBox

Changeset 37818 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
Jul 7, 2011 1:25:03 PM (14 years ago)
Author:
vboxsync
Message:

Fix logging from R0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/log/log.cpp

    r37605 r37818  
    10601060RT_EXPORT_SYMBOL(RTLogSetCustomPrefixCallbackForR0);
    10611061
     1062RTDECL(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}
     1107RT_EXPORT_SYMBOL(RTLogFlushR0);
     1108
    10621109# endif /* IN_RING3 */
    10631110
     
    10891136                {
    10901137                    pSrcLogger->offScratch = 0;
    1091                     rtlogLock(pSrcLogger);
     1138                    rtlogUnlock(pSrcLogger);
    10921139                }
    10931140            }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette