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/rsconf.c
static rsRetVal load(rsconf_t** cnf, uchar* confFile)
{
    int iNbrActions = 0;
    int r;
    DEFiRet;

    CHKiRet(rsconfConstruct(&loadConf));
    ourConf = loadConf; // TODO: remove, once ourConf is gone!

    CHKiRet(loadBuildInModules());
    CHKiRet(initLegacyConf());

    /* open the configuration file */
    r = cnfSetLexFile((char*)confFile);
    if (r == 0)
    {
        r = yyparse();
        conf.GetNbrActActions(loadConf, &iNbrActions);
    }

    /* we run the optimizer even if we have an error, as it may spit out
     * additional error messages and we want to see these even if we abort.
     */
    rulesetOptimizeAll(loadConf);

    if (r == 1)
    {
        LogError(0, RS_RET_CONF_PARSE_ERROR,
                 "could not interpret master "
                 "config file '%s'.",
                 confFile);
        ABORT_FINALIZE(RS_RET_CONF_PARSE_ERROR);
    }
    else if (r == 2)
    { /* file not found? */
        LogError(errno, RS_RET_CONF_FILE_NOT_FOUND,
                 "could not open config file '%s'", confFile);
        ABORT_FINALIZE(RS_RET_CONF_FILE_NOT_FOUND);
    }
    else if ((iNbrActions == 0) && !(iConfigVerify & CONF_VERIFY_PARTIAL_CONF))
    {
        LogError(0, RS_RET_NO_ACTIONS,
                 "there are no active actions configured. "
                 "Inputs would run, but no output whatsoever were created.");
        ABORT_FINALIZE(RS_RET_NO_ACTIONS);
    }
    tellLexEndParsing();
    DBGPRINTF("Number of actions in this configuration: %d\n", iActionNbr);

    CHKiRet(tellCoreConfigLoadDone());
    tellModulesConfigLoadDone();

    tellModulesCheckConfig();
    CHKiRet(validateConf());

    /* we are done checking the config - now validate if we should actually run
     * or not. If not, terminate. -- rgerhards, 2008-07-25
     * TODO: iConfigVerify -- should it be pulled from the config, or leave as
     * is (option)?
     */
    if (iConfigVerify)
    {
        if (iRet == RS_RET_OK)
            iRet = RS_RET_VALIDATION_RUN;
        FINALIZE;
    }

    /* all OK, pass loaded conf to caller */
    *cnf = loadConf;
    // TODO: enable this once all config code is moved to here!	loadConf = NULL;

    dbgprintf("rsyslog finished loading master config %p\n", loadConf);
    rsconfDebugPrint(loadConf);

finalize_it:
    RETiRet;
}
/* Load a configuration. This will do all necessary steps to create
 * the in-memory representation of the configuration, including support
 * for multiple configuration languages.
 * Note that to support the legacy language we must provide some global
 * object that holds the currently-being-loaded config ptr.
 * Begun 2011-04-20, rgerhards
 */
Load a configuration. This will do all necessary steps to create
the in-memory representation of the configuration, including support
for multiple configuration languages.
Note that to support the legacy language we must provide some global
object that holds the currently-being-loaded config ptr.
Load a configuration . This will do all necessary steps to create the in - memory representation of the configuration including support for multiple configuration languages . Note that to support the legacy language we must provide some global object that holds the currently - being - loaded config ptr .
static rsRetVal load(rsconf_t** cnf, uchar* confFile)
{
    int iNbrActions = 0;
    int r;
    DEFiRet;
    CHKiRet(rsconfConstruct(&loadConf));
    ourConf = loadConf; 
    CHKiRet(loadBuildInModules());
    CHKiRet(initLegacyConf());
    r = cnfSetLexFile((char*)confFile);
    if (r == 0)
    {
        r = yyparse();
        conf.GetNbrActActions(loadConf, &iNbrActions);
    }
    rulesetOptimizeAll(loadConf);
    if (r == 1)
    {
        LogError(0, RS_RET_CONF_PARSE_ERROR,
                 "could not interpret master "
                 "config file '%s'.",
                 confFile);
        ABORT_FINALIZE(RS_RET_CONF_PARSE_ERROR);
    }
    else if (r == 2)
    { 
        LogError(errno, RS_RET_CONF_FILE_NOT_FOUND,
                 "could not open config file '%s'", confFile);
        ABORT_FINALIZE(RS_RET_CONF_FILE_NOT_FOUND);
    }
    else if ((iNbrActions == 0) && !(iConfigVerify & CONF_VERIFY_PARTIAL_CONF))
    {
        LogError(0, RS_RET_NO_ACTIONS,
                 "there are no active actions configured. "
                 "Inputs would run, but no output whatsoever were created.");
        ABORT_FINALIZE(RS_RET_NO_ACTIONS);
    }
    tellLexEndParsing();
    DBGPRINTF("Number of actions in this configuration: %d\n", iActionNbr);
    CHKiRet(tellCoreConfigLoadDone());
    tellModulesConfigLoadDone();
    tellModulesCheckConfig();
    CHKiRet(validateConf());
    if (iConfigVerify)
    {
        if (iRet == RS_RET_OK)
            iRet = RS_RET_VALIDATION_RUN;
        FINALIZE;
    }
    *cnf = loadConf;
    dbgprintf("rsyslog finished loading master config %p\n", loadConf);
    rsconfDebugPrint(loadConf);
finalize_it:
    RETiRet;
}
static rsRetVal load ( rsconf_t * * cnf , uchar * confFile ) { int iNbrActions = 0 ; int r ; DEFiRet ; CHKiRet ( rsconfConstruct ( & loadConf ) ) ; ourConf = loadConf ; CHKiRet ( loadBuildInModules ( ) ) ; CHKiRet ( initLegacyConf ( ) ) ; r = cnfSetLexFile ( ( char * ) confFile ) ; if ( r == 0 ) { r = yyparse ( ) ; conf . GetNbrActActions ( loadConf , & iNbrActions ) ; } rulesetOptimizeAll ( loadConf ) ; if ( r == 1 ) { LogError ( 0 , RS_RET_CONF_PARSE_ERROR , " " " " , confFile ) ; ABORT_FINALIZE ( RS_RET_CONF_PARSE_ERROR ) ; } else if ( r == 2 ) { LogError ( errno , RS_RET_CONF_FILE_NOT_FOUND , " " , confFile ) ; ABORT_FINALIZE ( RS_RET_CONF_FILE_NOT_FOUND ) ; } else if ( ( iNbrActions == 0 ) && ! ( iConfigVerify & CONF_VERIFY_PARTIAL_CONF ) ) { LogError ( 0 , RS_RET_NO_ACTIONS , " " " " ) ; ABORT_FINALIZE ( RS_RET_NO_ACTIONS ) ; } tellLexEndParsing ( ) ; DBGPRINTF ( " \n " , iActionNbr ) ; CHKiRet ( tellCoreConfigLoadDone ( ) ) ; tellModulesConfigLoadDone ( ) ; tellModulesCheckConfig ( ) ; CHKiRet ( validateConf ( ) ) ; if ( iConfigVerify ) { if ( iRet == RS_RET_OK ) iRet = RS_RET_VALIDATION_RUN ; FINALIZE ; } * cnf = loadConf ; dbgprintf ( " \n " , loadConf ) ; rsconfDebugPrint ( loadConf ) ; finalize_it : RETiRet ; }
Load a configuration.
Load a configuration .
// TODO: remove, once ourConf is gone! /* open the configuration file */ /* we run the optimizer even if we have an error, as it may spit out
     * additional error messages and we want to see these even if we abort.
     */ /* file not found? */ /* we are done checking the config - now validate if we should actually run
     * or not. If not, terminate. -- rgerhards, 2008-07-25
     * TODO: iConfigVerify -- should it be pulled from the config, or leave as
     * is (option)?
     */ /* all OK, pass loaded conf to caller */ // TODO: enable this once all config code is moved to here!	loadConf = NULL;