diff options
author | Milan Bartos <mbartos@redhat.com> | 2012-09-17 10:14:45 +0200 |
---|---|---|
committer | Milan Bartos <mbartos@redhat.com> | 2012-09-24 08:45:33 +0200 |
commit | 432934b3dd2f5b2802a76f568b634c01a382e4a8 (patch) | |
tree | 3557db73030226d72a0a5654e118871f617ddaff | |
parent | 498b8600707e979f78ee02641d56702784138b70 (diff) | |
download | rsyslog-432934b3dd2f5b2802a76f568b634c01a382e4a8.tar.gz rsyslog-432934b3dd2f5b2802a76f568b634c01a382e4a8.tar.bz2 rsyslog-432934b3dd2f5b2802a76f568b634c01a382e4a8.zip |
Remove unnecessary config options in imkmsg
modified: plugins/imkmsg/imkmsg.c
modified: plugins/imkmsg/kmsg.c
-rw-r--r-- | plugins/imkmsg/imkmsg.c | 80 | ||||
-rw-r--r-- | plugins/imkmsg/kmsg.c | 9 |
2 files changed, 2 insertions, 87 deletions
diff --git a/plugins/imkmsg/imkmsg.c b/plugins/imkmsg/imkmsg.c index 20c49f60..2a97f82d 100644 --- a/plugins/imkmsg/imkmsg.c +++ b/plugins/imkmsg/imkmsg.c @@ -64,8 +64,6 @@ DEFobjCurrIf(errmsg) /* config settings */ typedef struct configSettings_s { int iFacilIntMsg; /* the facility to use for internal messages (set by driver) */ - uchar *pszPath; - int console_log_level; /* still used for BSD */ } configSettings_t; static configSettings_t cs; @@ -73,26 +71,12 @@ static modConfData_t *loadModConf = NULL;/* modConf ptr to use for the current l static modConfData_t *runModConf = NULL;/* modConf ptr to use for the current load process */ static int bLegacyCnfModGlobalsPermitted;/* are legacy module-global config parameters permitted? */ -/* module-global parameters */ -static struct cnfparamdescr modpdescr[] = { - { "logpath", eCmdHdlrGetWord, 0 }, - { "consoleloglevel", eCmdHdlrInt, 0 }, - { "internalmsgfacility", eCmdHdlrFacility, 0 } -}; -static struct cnfparamblk modpblk = - { CNFPARAMBLK_VERSION, - sizeof(modpdescr)/sizeof(struct cnfparamdescr), - modpdescr - }; - static prop_t *pInputName = NULL; /* there is only one global inputName for all messages generated by this module */ static prop_t *pLocalHostIP = NULL; /* a pseudo-constant propterty for 127.0.0.1 */ static inline void initConfigSettings(void) { - cs.console_log_level = -1; - cs.pszPath = NULL; cs.iFacilIntMsg = klogFacilIntMsg(); } @@ -198,9 +182,6 @@ CODESTARTbeginCnfLoad loadModConf = pModConf; pModConf->pConf = pConf; /* init our settings */ - pModConf->pszPath = NULL; - pModConf->bPermitNonKernel = 0; - pModConf->console_log_level = -1; pModConf->iFacilIntMsg = klogFacilIntMsg(); loadModConf->configSetViaV2Method = 0; bLegacyCnfModGlobalsPermitted = 1; @@ -209,61 +190,11 @@ CODESTARTbeginCnfLoad ENDbeginCnfLoad -BEGINsetModCnf - struct cnfparamvals *pvals = NULL; - int i; -CODESTARTsetModCnf - pvals = nvlstGetParams(lst, &modpblk, NULL); - if(pvals == NULL) { - errmsg.LogError(0, RS_RET_MISSING_CNFPARAMS, "error processing module " - "config parameters [module(...)]"); - ABORT_FINALIZE(RS_RET_MISSING_CNFPARAMS); - } - - if(Debug) { - dbgprintf("module (global) param blk for imkmsg:\n"); - cnfparamsPrint(&modpblk, pvals); - } - - for(i = 0 ; i < modpblk.nParams ; ++i) { - if(!pvals[i].bUsed) - continue; - if(!strcmp(modpblk.descr[i].name, "logpath")) { - loadModConf->pszPath = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL); - } else if(!strcmp(modpblk.descr[i].name, "consoleloglevel")) { - loadModConf->console_log_level= (int) pvals[i].val.d.n; - } else if(!strcmp(modpblk.descr[i].name, "internalmsgfacility")) { - loadModConf->iFacilIntMsg = (int) pvals[i].val.d.n; - } else { - dbgprintf("imkmsg: program error, non-handled " - "param '%s' in beginCnfLoad\n", modpblk.descr[i].name); - } - } - - /* disable legacy module-global config directives */ - bLegacyCnfModGlobalsPermitted = 0; - loadModConf->configSetViaV2Method = 1; - -finalize_it: - if(pvals != NULL) - cnfparamvalsDestruct(pvals, &modpblk); -ENDsetModCnf - - BEGINendCnfLoad CODESTARTendCnfLoad if(!loadModConf->configSetViaV2Method) { /* persist module-specific settings from legacy config system */ loadModConf->iFacilIntMsg = cs.iFacilIntMsg; - loadModConf->console_log_level = cs.console_log_level; - if((cs.pszPath == NULL) || (cs.pszPath[0] == '\0')) { - loadModConf->pszPath = NULL; - if(cs.pszPath != NULL) - free(cs.pszPath); - } else { - loadModConf->pszPath = cs.pszPath; - } - cs.pszPath = NULL; } loadModConf = NULL; /* done loading */ @@ -323,16 +254,11 @@ BEGINqueryEtryPt CODESTARTqueryEtryPt CODEqueryEtryPt_STD_IMOD_QUERIES CODEqueryEtryPt_STD_CONF2_QUERIES -CODEqueryEtryPt_STD_CONF2_setModCnf_QUERIES CODEqueryEtryPt_STD_CONF2_PREPRIVDROP_QUERIES ENDqueryEtryPt static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __attribute__((unused)) *pVal) { - if(cs.pszPath != NULL) { - free(cs.pszPath); - cs.pszPath = NULL; - } cs.iFacilIntMsg = klogFacilIntMsg(); return RS_RET_OK; } @@ -356,18 +282,12 @@ CODEmodInit_QueryRegCFSLineHdlr CHKiRet(omsdRegCFSLineHdlr((uchar *)"debugprintkernelsymbols", 0, eCmdHdlrGoneAway, NULL, NULL, STD_LOADABLE_MODULE_ID)); - CHKiRet(regCfSysLineHdlr2((uchar *)"klogpath", 0, eCmdHdlrGetWord, - NULL, &cs.pszPath, STD_LOADABLE_MODULE_ID, &bLegacyCnfModGlobalsPermitted)); CHKiRet(omsdRegCFSLineHdlr((uchar *)"klogsymbollookup", 0, eCmdHdlrGoneAway, NULL, NULL, STD_LOADABLE_MODULE_ID)); CHKiRet(omsdRegCFSLineHdlr((uchar *)"klogsymbolstwice", 0, eCmdHdlrGoneAway, NULL, NULL, STD_LOADABLE_MODULE_ID)); CHKiRet(omsdRegCFSLineHdlr((uchar *)"klogusesyscallinterface", 0, eCmdHdlrGoneAway, NULL, NULL, STD_LOADABLE_MODULE_ID)); - CHKiRet(regCfSysLineHdlr2((uchar *)"klogconsoleloglevel", 0, eCmdHdlrInt, - NULL, &cs.console_log_level, STD_LOADABLE_MODULE_ID, &bLegacyCnfModGlobalsPermitted)); - CHKiRet(regCfSysLineHdlr2((uchar *)"kloginternalmsgfacility", 0, eCmdHdlrFacility, - NULL, &cs.iFacilIntMsg, STD_LOADABLE_MODULE_ID, &bLegacyCnfModGlobalsPermitted)); CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID)); ENDmodInit diff --git a/plugins/imkmsg/kmsg.c b/plugins/imkmsg/kmsg.c index 9f1de60f..9ad98da4 100644 --- a/plugins/imkmsg/kmsg.c +++ b/plugins/imkmsg/kmsg.c @@ -134,11 +134,6 @@ submitSyslog(uchar *buf) } -static uchar *GetPath(modConfData_t *pModConf) -{ - return pModConf->pszPath ? pModConf->pszPath : (uchar*) _PATH_KLOG; -} - /* open the kernel log - will be called inside the willRun() imkmsg entry point */ rsRetVal @@ -148,10 +143,10 @@ klogWillRun(modConfData_t *pModConf) int r; DEFiRet; - fklog = open((char*)GetPath(pModConf), O_RDONLY, 0); + fklog = open(_PATH_KLOG, O_RDONLY, 0); if (fklog < 0) { imkmsgLogIntMsg(RS_RET_ERR_OPEN_KLOG, "imkmsg: cannot open kernel log(%s): %s.", - GetPath(pModConf), rs_strerror_r(errno, errmsg, sizeof(errmsg))); + _PATH_KLOG, rs_strerror_r(errno, errmsg, sizeof(errmsg))); ABORT_FINALIZE(RS_RET_ERR_OPEN_KLOG); } |