openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/rsyslog/8.1903.0-r0/rsyslog-8.1903.0/runtime/debug.c
rsRetVal dbgClassInit(void)
{
    rsRetVal iRet; /* do not use DEFiRet, as this makes calls into the debug
                      system! */

    (void)pthread_key_create(&keyThrdName, dbgThrdNameDestruct);

    /* while we try not to use any of the real rsyslog code (to avoid infinite
     * loops), we need to have the ability to query object names. Thus, we need
     * to obtain a pointer to the object interface. -- rgerhards, 2008-02-29
     */
    CHKiRet(objGetObjInterface(
        &obj)); /* this provides the root pointer for all other queries */

    const char* dbgto2stderr;
    dbgto2stderr = getenv("RSYSLOG_DEBUG_TIMEOUTS_TO_STDERR");
    dbgTimeoutToStderr =
        (dbgto2stderr != NULL && !strcmp(dbgto2stderr, "on")) ? 1 : 0;
    if (dbgTimeoutToStderr)
    {
        fprintf(stderr,
                "rsyslogd: NOTE: RSYSLOG_DEBUG_TIMEOUTS_TO_STDERR activated\n");
    }
    dbgGetRuntimeOptions(); /* init debug system from environment */
    pszAltDbgFileName = getenv("RSYSLOG_DEBUGLOG");

    if (pszAltDbgFileName != NULL)
    {
        /* we have a secondary file, so let's open it) */
        if ((altdbg = open(pszAltDbgFileName,
                           O_WRONLY | O_CREAT | O_TRUNC | O_NOCTTY | O_CLOEXEC,
                           S_IRUSR | S_IWUSR)) == -1)
        {
            fprintf(stderr,
                    "alternate debug file could not be opened, ignoring. "
                    "Error: %s\n",
                    strerror(errno));
        }
    }

    dbgSetThrdName((uchar*)"main thread");

finalize_it:
    return (iRet);
}
/* end support system to set debug options at runtime */
end support system to set debug options at runtime
end support system to set debug options at runtime
rsRetVal dbgClassInit(void)
{
    rsRetVal iRet; 
    (void)pthread_key_create(&keyThrdName, dbgThrdNameDestruct);
    CHKiRet(objGetObjInterface(
        &obj)); 
    const char* dbgto2stderr;
    dbgto2stderr = getenv("RSYSLOG_DEBUG_TIMEOUTS_TO_STDERR");
    dbgTimeoutToStderr =
        (dbgto2stderr != NULL && !strcmp(dbgto2stderr, "on")) ? 1 : 0;
    if (dbgTimeoutToStderr)
    {
        fprintf(stderr,
                "rsyslogd: NOTE: RSYSLOG_DEBUG_TIMEOUTS_TO_STDERR activated\n");
    }
    dbgGetRuntimeOptions(); 
    pszAltDbgFileName = getenv("RSYSLOG_DEBUGLOG");
    if (pszAltDbgFileName != NULL)
    {
        if ((altdbg = open(pszAltDbgFileName,
                           O_WRONLY | O_CREAT | O_TRUNC | O_NOCTTY | O_CLOEXEC,
                           S_IRUSR | S_IWUSR)) == -1)
        {
            fprintf(stderr,
                    "alternate debug file could not be opened, ignoring. "
                    "Error: %s\n",
                    strerror(errno));
        }
    }
    dbgSetThrdName((uchar*)"main thread");
finalize_it:
    return (iRet);
}
rsRetVal dbgClassInit ( void ) { rsRetVal iRet ; ( void ) pthread_key_create ( & keyThrdName , dbgThrdNameDestruct ) ; CHKiRet ( objGetObjInterface ( & obj ) ) ; const char * dbgto2stderr ; dbgto2stderr = getenv ( " " ) ; dbgTimeoutToStderr = ( dbgto2stderr != NULL && ! strcmp ( dbgto2stderr , " " ) ) ? 1 : 0 ; if ( dbgTimeoutToStderr ) { fprintf ( stderr , " \n " ) ; } dbgGetRuntimeOptions ( ) ; pszAltDbgFileName = getenv ( " " ) ; if ( pszAltDbgFileName != NULL ) { if ( ( altdbg = open ( pszAltDbgFileName , O_WRONLY | O_CREAT | O_TRUNC | O_NOCTTY | O_CLOEXEC , S_IRUSR | S_IWUSR ) ) == -1 ) { fprintf ( stderr , " " " \n " , strerror ( errno ) ) ; } } dbgSetThrdName ( ( uchar * ) " " ) ; finalize_it : return ( iRet ) ; }
end support system to set debug options at runtime
end support system to set debug options at runtime
/* do not use DEFiRet, as this makes calls into the debug
                      system! */ /* while we try not to use any of the real rsyslog code (to avoid infinite
     * loops), we need to have the ability to query object names. Thus, we need
     * to obtain a pointer to the object interface. -- rgerhards, 2008-02-29
     */ /* this provides the root pointer for all other queries */ /* init debug system from environment */ /* we have a secondary file, so let's open it) */