VirtualBox

Changeset 72426 in vbox for trunk/src/VBox/Runtime/common


Ignore:
Timestamp:
Jun 4, 2018 11:38:23 AM (7 years ago)
Author:
vboxsync
Message:

IPRT,VMM: Added custom thread name for ring-0 logging (VMM).

File:
1 edited

Legend:

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

    r69969 r72426  
    175175    char * volatile         pchRingBufCur;
    176176    /** @} */
     177
     178    /** Thread name for use in ring-0 with RTLOGFLAGS_PREFIX_THREAD. */
     179    char                    szR0ThreadName[16];
    177180
    178181# ifdef IN_RING3 /* Note! Must be at the end! */
     
    826829        pLogger->pInt->pfnPrefix                = NULL;
    827830        pLogger->pInt->pvPrefixUserArg          = NULL;
    828         pLogger->pInt->afPadding1[0]            = false;
    829         pLogger->pInt->afPadding1[1]            = false;
    830831        pLogger->pInt->fCreated                 = false;
     832        RT_ZERO(pLogger->pInt->szR0ThreadName);
    831833        pLogger->pInt->cMaxGroups               = cGroups;
    832834        pLogger->pInt->papszGroups              = papszGroups;
     
    12741276RTDECL(int) RTLogCreateForR0(PRTLOGGER pLogger, size_t cbLogger,
    12751277                             RTR0PTR pLoggerR0Ptr, RTR0PTR pfnLoggerR0Ptr, RTR0PTR pfnFlushR0Ptr,
    1276                              uint32_t fFlags, uint32_t fDestFlags)
     1278                             uint32_t fFlags, uint32_t fDestFlags, char const *pszThreadName)
    12771279{
    12781280    /*
     
    12841286    AssertReturn(pLoggerR0Ptr != NIL_RTR0PTR, VERR_INVALID_PARAMETER);
    12851287    AssertReturn(pfnLoggerR0Ptr != NIL_RTR0PTR, VERR_INVALID_PARAMETER);
     1288    size_t const cchThreadName = pszThreadName ? strlen(pszThreadName) : 0;
     1289    AssertReturn(cchThreadName < sizeof(pLogger->pInt->szR0ThreadName), VERR_INVALID_NAME);
    12861290
    12871291    /*
     
    13271331    else
    13281332        pInt->pacEntriesPerGroup= NULL;
     1333
     1334    RT_ZERO(pInt->szR0ThreadName);
     1335    if (cchThreadName)
     1336        memcpy(pInt->szR0ThreadName, pszThreadName, cchThreadName);
    13291337
    13301338    pInt->fCreated              = true;
     
    38153823                    const char *pszName = "EMT-RC";
    38163824#else
    3817                     const char *pszName = "R0";
     3825                    const char *pszName = pLogger->pInt->szR0ThreadName[0] ? pLogger->pInt->szR0ThreadName : "R0";
    38183826#endif
    38193827                    psz = rtLogStPNCpyPad(psz, pszName, 16, 8);
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