summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-05-25 14:04:14 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2011-05-25 14:04:14 +0200
commita9223031a6effeaf3673beb752c12a29f5e8f83d (patch)
tree0b69e2b9ea00b1d7471a7be9bc3faee9a5b84f03
parent0c9ff64a62d3ac84eef48c577d6ab8aa754fd8c3 (diff)
downloadrsyslog-a9223031a6effeaf3673beb752c12a29f5e8f83d.tar.gz
rsyslog-a9223031a6effeaf3673beb752c12a29f5e8f83d.tar.xz
rsyslog-a9223031a6effeaf3673beb752c12a29f5e8f83d.zip
step: imklog (linux) moved to v2 config system
-rw-r--r--plugins/imklog/imklog.c182
-rw-r--r--plugins/imklog/imklog.h26
-rw-r--r--plugins/imklog/ksym.c32
-rw-r--r--plugins/imklog/linux.c59
-rw-r--r--plugins/imptcp/imptcp.c1
5 files changed, 188 insertions, 112 deletions
diff --git a/plugins/imklog/imklog.c b/plugins/imklog/imklog.c
index 425dec7f..65a4cd57 100644
--- a/plugins/imklog/imklog.c
+++ b/plugins/imklog/imklog.c
@@ -18,7 +18,10 @@
* Please note that this file replaces the klogd daemon that was
* also present in pre-v3 versions of rsyslog.
*
- * Copyright (C) 2008, 2009 by Rainer Gerhards and Adiscon GmbH
+ * To test under Linux:
+ * echo test1 > /dev/kmsg
+ *
+ * Copyright (C) 2008-2011 by Rainer Gerhards and Adiscon GmbH
*
* This file is part of rsyslog.
*
@@ -66,32 +69,43 @@ DEFobjCurrIf(datetime)
DEFobjCurrIf(glbl)
DEFobjCurrIf(prop)
-/* configuration settings */
-
-struct modConfData_s {
- EMPTY_STRUCT;
-};
-
-int dbgPrintSymbols = 0; /* this one is extern so the helpers can access it! */
-int symbols_twice = 0;
-int use_syscall = 0;
-int symbol_lookup = 0; /* on recent kernels > 2.6, the kernel does this */
-int bPermitNonKernel = 0; /* permit logging of messages not having LOG_KERN facility */
-int iFacilIntMsg; /* the facility to use for internal messages (set by driver) */
-uchar *pszPath = NULL;
-int console_log_level = -1;
-/* TODO: configuration for the following directives must be implemented. It
- * was not done yet because we either do not yet have a config handler for
- * that type or I thought it was acceptable to push it to a later stage when
- * I gained more handson experience with the input module interface (and the
- * changes resulting from that). -- rgerhards, 2007-12-20
- */
-char *symfile = NULL;
+/* config settings */
+typedef struct configSettings_s {
+ int dbgPrintSymbols; /* this one is extern so the helpers can access it! */
+ int symbols_twice;
+ int use_syscall;
+ int symbol_lookup; /* on recent kernels > 2.6, the kernel does this */
+ int bPermitNonKernel; /* permit logging of messages not having LOG_KERN facility */
+ int iFacilIntMsg; /* the facility to use for internal messages (set by driver) */
+ uchar *pszPath;
+ int console_log_level;
+ char *symfile; /* TODO: actually unsued currently! */
+} configSettings_t;
+static configSettings_t cs;
+
+static modConfData_t *loadModConf = NULL;/* modConf ptr to use for the current load process */
+static modConfData_t *runModConf = NULL;/* modConf ptr to use for the current load process */
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.dbgPrintSymbols = 0;
+ cs.symbols_twice = 0;
+ cs.use_syscall = 0;
+ cs.symbol_lookup = 0;
+ cs.bPermitNonKernel = 0;
+ cs.console_log_level = -1;
+ cs.pszPath = NULL;
+ cs.symfile = NULL;
+ cs.iFacilIntMsg = klogFacilIntMsg();
+}
+
+
/* enqueue the the kernel message into the message queue.
* The provided msg string is not freed - thus must be done
* by the caller.
@@ -178,8 +192,7 @@ rsRetVal imklogLogIntMsg(int priority, char *fmt, ...)
pLogMsg = msgBuf;
va_end(ap);
- iRet = enqMsg((uchar*)pLogMsg, (uchar*) ((iFacilIntMsg == LOG_KERN) ? "kernel:" : "imklog:"),
- iFacilIntMsg, LOG_PRI(priority));
+ logmsgInternal(NO_ERRCODE ,priority, msgBuf, 0);
RETiRet;
}
@@ -216,7 +229,7 @@ rsRetVal Syslog(int priority, uchar *pMsg)
/* if we don't get the pri, we use whatever we were supplied */
/* ignore non-kernel messages if not permitted */
- if(bPermitNonKernel == 0 && LOG_FAC(priority) != LOG_KERN)
+ if(cs.bPermitNonKernel == 0 && LOG_FAC(priority) != LOG_KERN)
FINALIZE; /* silently ignore */
iRet = enqMsg((uchar*)pMsg, (uchar*) "kernel:", LOG_FAC(priority), LOG_PRI(priority));
@@ -248,7 +261,7 @@ CODESTARTrunInput
* and then submits it to the rsyslog main queue.
* rgerhards, 2008-04-09
*/
- CHKiRet(klogLogKMsg());
+ CHKiRet(klogLogKMsg(runModConf));
}
finalize_it:
ENDrunInput
@@ -256,11 +269,45 @@ ENDrunInput
BEGINbeginCnfLoad
CODESTARTbeginCnfLoad
+ loadModConf = pModConf;
+ pModConf->pConf = pConf;
+ /* init legacy config vars */
+ initConfigSettings();
ENDbeginCnfLoad
BEGINendCnfLoad
CODESTARTendCnfLoad
+ /* persist module-specific settings from legacy config system */
+ loadModConf->dbgPrintSymbols = cs.dbgPrintSymbols;
+ loadModConf->symbols_twice = cs.symbols_twice;
+ loadModConf->use_syscall = cs.use_syscall;
+ loadModConf->bPermitNonKernel = cs.bPermitNonKernel;
+ 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;
+ if((cs.symfile == NULL) || (cs.symfile[0] == '\0')) {
+ loadModConf->symfile = NULL;
+ if(cs.symfile != NULL)
+ free(cs.symfile);
+ } else {
+ loadModConf->symfile = cs.symfile;
+ }
+ cs.symfile = NULL;
+
+ loadModConf = NULL; /* done loading */
+ /* free legacy config vars */
+ free(cs.pszPath);
+ cs.pszPath = NULL;
+ free(cs.symfile);
+ cs.symfile = NULL;
ENDendCnfLoad
@@ -269,6 +316,13 @@ CODESTARTcheckCnf
ENDcheckCnf
+BEGINactivateCnfPrePrivDrop
+CODESTARTactivateCnfPrePrivDrop
+ runModConf = pModConf;
+ iRet = klogWillRun(runModConf);
+ENDactivateCnfPrePrivDrop
+
+
BEGINactivateCnf
CODESTARTactivateCnf
ENDactivateCnf
@@ -281,55 +335,49 @@ ENDfreeCnf
BEGINwillRun
CODESTARTwillRun
- /* we need to create the inputName property (only once during our lifetime) */
- CHKiRet(prop.CreateStringProp(&pInputName, UCHAR_CONSTANT("imklog"), sizeof("imklog") - 1));
- CHKiRet(prop.CreateStringProp(&pLocalHostIP, UCHAR_CONSTANT("127.0.0.1"), sizeof("127.0.0.1") - 1));
-
- iRet = klogWillRun();
-finalize_it:
ENDwillRun
BEGINafterRun
CODESTARTafterRun
- iRet = klogAfterRun();
+ iRet = klogAfterRun(runModConf);
+ENDafterRun
+
+BEGINmodExit
+CODESTARTmodExit
if(pInputName != NULL)
prop.Destruct(&pInputName);
if(pLocalHostIP != NULL)
prop.Destruct(&pLocalHostIP);
-ENDafterRun
-
-BEGINmodExit
-CODESTARTmodExit
/* release objects we used */
objRelease(glbl, CORE_COMPONENT);
objRelease(datetime, CORE_COMPONENT);
objRelease(prop, CORE_COMPONENT);
- if(pszPath != NULL)
- free(pszPath);
ENDmodExit
BEGINqueryEtryPt
CODESTARTqueryEtryPt
CODEqueryEtryPt_STD_IMOD_QUERIES
+CODEqueryEtryPt_STD_CONF2_QUERIES
+CODEqueryEtryPt_STD_CONF2_PREPRIVDROP_QUERIES
ENDqueryEtryPt
static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __attribute__((unused)) *pVal)
{
- dbgPrintSymbols = 0;
- symbols_twice = 0;
- use_syscall = 0;
- symfile = NULL;
- symbol_lookup = 0;
- bPermitNonKernel = 0;
- if(pszPath != NULL) {
- free(pszPath);
- pszPath = NULL;
+ cs.dbgPrintSymbols = 0;
+ cs.symbols_twice = 0;
+ cs.use_syscall = 0;
+ cs.symfile = NULL;
+ cs.symbol_lookup = 0;
+ cs.bPermitNonKernel = 0;
+ if(cs.pszPath != NULL) {
+ free(cs.pszPath);
+ cs.pszPath = NULL;
}
- iFacilIntMsg = klogFacilIntMsg();
+ cs.iFacilIntMsg = klogFacilIntMsg();
return RS_RET_OK;
}
@@ -341,17 +389,31 @@ CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(objUse(glbl, CORE_COMPONENT));
CHKiRet(objUse(prop, CORE_COMPONENT));
- iFacilIntMsg = klogFacilIntMsg();
-
- CHKiRet(omsdRegCFSLineHdlr((uchar *)"debugprintkernelsymbols", 0, eCmdHdlrBinary, NULL, &dbgPrintSymbols, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
- CHKiRet(omsdRegCFSLineHdlr((uchar *)"klogpath", 0, eCmdHdlrGetWord, NULL, &pszPath, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
- CHKiRet(omsdRegCFSLineHdlr((uchar *)"klogsymbollookup", 0, eCmdHdlrBinary, NULL, &symbol_lookup, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
- CHKiRet(omsdRegCFSLineHdlr((uchar *)"klogsymbolstwice", 0, eCmdHdlrBinary, NULL, &symbols_twice, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
- CHKiRet(omsdRegCFSLineHdlr((uchar *)"klogusesyscallinterface", 0, eCmdHdlrBinary, NULL, &use_syscall, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
- CHKiRet(omsdRegCFSLineHdlr((uchar *)"klogpermitnonkernelfacility", 0, eCmdHdlrBinary, NULL, &bPermitNonKernel, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
- CHKiRet(omsdRegCFSLineHdlr((uchar *)"klogconsoleloglevel", 0, eCmdHdlrInt, NULL, &console_log_level, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
- CHKiRet(omsdRegCFSLineHdlr((uchar *)"kloginternalmsgfacility", 0, eCmdHdlrFacility, NULL, &iFacilIntMsg, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
- CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
+ /* we need to create the inputName property (only once during our lifetime) */
+ CHKiRet(prop.CreateStringProp(&pInputName, UCHAR_CONSTANT("imklog"), sizeof("imklog") - 1));
+ CHKiRet(prop.CreateStringProp(&pLocalHostIP, UCHAR_CONSTANT("127.0.0.1"), sizeof("127.0.0.1") - 1));
+
+ /* init legacy config settings */
+ initConfigSettings();
+
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"debugprintkernelsymbols", 0, eCmdHdlrBinary,
+ NULL, &cs.dbgPrintSymbols, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"klogpath", 0, eCmdHdlrGetWord,
+ NULL, &cs.pszPath, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"klogsymbollookup", 0, eCmdHdlrBinary,
+ NULL, &cs.symbol_lookup, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"klogsymbolstwice", 0, eCmdHdlrBinary,
+ NULL, &cs.symbols_twice, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"klogusesyscallinterface", 0, eCmdHdlrBinary,
+ NULL, &cs.use_syscall, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"klogpermitnonkernelfacility", 0, eCmdHdlrBinary,
+ NULL, &cs.bPermitNonKernel, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"klogconsoleloglevel", 0, eCmdHdlrInt,
+ NULL, &cs.console_log_level, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"kloginternalmsgfacility", 0, eCmdHdlrFacility,
+ NULL, &cs.iFacilIntMsg, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler,
+ resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
ENDmodInit
/* vim:set ai:
*/
diff --git a/plugins/imklog/imklog.h b/plugins/imklog/imklog.h
index c183026d..447211dc 100644
--- a/plugins/imklog/imklog.h
+++ b/plugins/imklog/imklog.h
@@ -30,22 +30,37 @@
#include "rsyslog.h"
#include "dirty.h"
+/* we need to have the modConf type present in all submodules */
+struct modConfData_s {
+ int dbgPrintSymbols;
+ int symbols_twice;
+ int use_syscall;
+ int symbol_lookup;
+ int bPermitNonKernel;
+ int iFacilIntMsg;
+ uchar *pszPath;
+ int console_log_level;
+ char *symfile;
+ rsconf_t *pConf;
+};
+
/* interface to "drivers"
* the platform specific drivers must implement these entry points. Only one
* driver may be active at any given time, thus we simply rely on the linker
* to resolve the addresses.
* rgerhards, 2008-04-09
*/
-rsRetVal klogLogKMsg(void);
-rsRetVal klogWillRun(void);
-rsRetVal klogAfterRun(void);
-int klogFacilIntMsg(void);
+rsRetVal klogLogKMsg(modConfData_t *pModConf);
+rsRetVal klogWillRun(modConfData_t *pModConf);
+rsRetVal klogAfterRun(modConfData_t *pModConf);
+int klogFacilIntMsg();
/* the following data members may be accessed by the "drivers"
* I admit this is not the cleanest way to doing things, but I honestly
* believe it is appropriate for the job that needs to be done.
* rgerhards, 2008-04-09
*/
+#if 0
extern int symbols_twice;
extern int use_syscall;
extern int symbol_lookup;
@@ -53,6 +68,7 @@ extern char *symfile;
extern int console_log_level;
extern int dbgPrintSymbols;
extern uchar *pszPath;
+#endif
/* the functions below may be called by the drivers */
rsRetVal imklogLogIntMsg(int priority, char *fmt, ...) __attribute__((format(printf,2, 3)));
@@ -60,7 +76,7 @@ rsRetVal Syslog(int priority, uchar *msg);
/* prototypes */
extern int klog_getMaxLine(void); /* work-around for klog drivers to get configured max line size */
-extern int InitKsyms(char *);
+extern int InitKsyms(modConfData_t*);
extern void DeinitKsyms(void);
extern int InitMsyms(void);
extern void DeinitMsyms(void);
diff --git a/plugins/imklog/ksym.c b/plugins/imklog/ksym.c
index ebaec011..beb5c637 100644
--- a/plugins/imklog/ksym.c
+++ b/plugins/imklog/ksym.c
@@ -139,11 +139,11 @@ static char *system_maps[] =
/* Function prototypes. */
-static char *FindSymbolFile(void);
+static char *FindSymbolFile(modConfData_t *);
static int AddSymbol(unsigned long, char*);
static void FreeSymbols(void);
static int CheckVersion(char *);
-static int CheckMapVersion(char *);
+static int CheckMapVersion(modConfData_t *, char *);
/*************************************************************************
@@ -152,7 +152,7 @@ static int CheckMapVersion(char *);
* Purpose: This function is responsible for initializing and loading
* the data tables used by the kernel address translations.
*
- * Arguements: (char *) mapfile
+ * Arguements: (char *) mapfile (taken from config)
*
* mapfile:-> A pointer to a complete path
* specification of the file containing
@@ -163,7 +163,7 @@ static int CheckMapVersion(char *);
* A boolean style context is returned. The return value will
* be true if initialization was successful. False if not.
**************************************************************************/
-extern int InitKsyms(char *mapfile)
+extern int InitKsyms(modConfData_t *pModConf)
{
auto char type,
sym[512];
@@ -182,20 +182,20 @@ extern int InitKsyms(char *mapfile)
/* Search for and open the file containing the kernel symbols. */
- if ( mapfile != NULL ) {
- if ( (sym_file = fopen(mapfile, "r")) == NULL )
+ if ( pModConf->symfile != NULL ) {
+ if ( (sym_file = fopen(pModConf->symfile, "r")) == NULL )
{
- imklogLogIntMsg(LOG_WARNING, "Cannot open map file: %s.", mapfile);
+ imklogLogIntMsg(LOG_WARNING, "Cannot open map file: %s.", pModConf->symfile);
return(0);
}
} else {
- if ( (mapfile = FindSymbolFile()) == NULL ) {
+ if ( (pModConf->symfile = FindSymbolFile(pModConf)) == NULL ) {
imklogLogIntMsg(LOG_WARNING, "Cannot find map file.");
dbgprintf("Cannot find map file.\n");
return(0);
}
- if ( (sym_file = fopen(mapfile, "r")) == NULL ) {
+ if ( (sym_file = fopen(pModConf->symfile, "r")) == NULL ) {
imklogLogIntMsg(LOG_WARNING, "Cannot open map file.");
dbgprintf("Cannot open map file.\n");
return(0);
@@ -216,7 +216,7 @@ extern int InitKsyms(char *mapfile)
fclose(sym_file);
return(0);
}
- if(dbgPrintSymbols)
+ if(pModConf->dbgPrintSymbols)
dbgprintf("Address: %lx, Type: %c, Symbol: %s\n", address, type, sym);
if ( AddSymbol(address, sym) == 0 ) {
@@ -230,7 +230,7 @@ extern int InitKsyms(char *mapfile)
}
- imklogLogIntMsg(LOG_INFO, "Loaded %d symbols from %s.", num_syms, mapfile);
+ imklogLogIntMsg(LOG_INFO, "Loaded %d symbols from %s.", num_syms, pModConf->symfile);
switch(version) {
case -1:
imklogLogIntMsg(LOG_WARNING, "Symbols do not match kernel version.");
@@ -290,7 +290,7 @@ extern void DeinitKsyms(void)
* caller which points to the name of the file containing
* the symbol table to be used.
**************************************************************************/
-static char *FindSymbolFile(void)
+static char *FindSymbolFile(modConfData_t *pModConf)
{
auto char *file = NULL,
**mf = system_maps;
@@ -310,7 +310,7 @@ static char *FindSymbolFile(void)
snprintf(mysymfile, sizeof(mysymfile), "%s-%s", *mf, utsname.release);
dbgprintf("Trying %s.\n", mysymfile);
if((sym_file = fopen(mysymfile, "r")) != NULL) {
- if(CheckMapVersion(mysymfile) == 1)
+ if(CheckMapVersion(pModConf, mysymfile) == 1)
file = mysymfile;
fclose(sym_file);
}
@@ -318,7 +318,7 @@ static char *FindSymbolFile(void)
sprintf (mysymfile, "%s", *mf);
dbgprintf("Trying %s.\n", mysymfile);
if((sym_file = fopen(mysymfile, "r")) != NULL ) {
- if (CheckMapVersion(mysymfile) == 1)
+ if (CheckMapVersion(pModConf, mysymfile) == 1)
file = mysymfile;
fclose(sym_file);
}
@@ -454,7 +454,7 @@ static int CheckVersion(char *version)
* 1:-> The executing kernel is of the same version
* as the version of the map file.
**************************************************************************/
-static int CheckMapVersion(char *fname)
+static int CheckMapVersion(modConfData_t *pModConf, char *fname)
{
int version;
FILE *sym_file;
@@ -477,7 +477,7 @@ static int CheckMapVersion(char *fname)
fclose(sym_file);
return(0);
}
- if(dbgPrintSymbols)
+ if(pModConf->dbgPrintSymbols)
dbgprintf("Address: %lx, Type: %c, Symbol: %s\n", address, type, sym);
version = CheckVersion(sym);
}
diff --git a/plugins/imklog/linux.c b/plugins/imklog/linux.c
index 727708a5..97171e4f 100644
--- a/plugins/imklog/linux.c
+++ b/plugins/imklog/linux.c
@@ -85,15 +85,15 @@ static enum LOGSRC {none, proc, kernel} logsrc;
extern int ksyslog(int type, char *buf, int len);
-static uchar *GetPath(void)
+static uchar *GetPath(modConfData_t *pModConf)
{
- return pszPath ? pszPath : UCHAR_CONSTANT(_PATH_KLOG);
+ return pModConf->pszPath ? pModConf->pszPath : UCHAR_CONSTANT(_PATH_KLOG);
}
-static void CloseLogSrc(void)
+static void CloseLogSrc(modConfData_t *pModConf)
{
/* Turn on logging of messages to console, but only if a log level was speficied */
- if(console_log_level != -1)
+ if(pModConf->console_log_level != -1)
ksyslog(7, NULL, 0);
/* Shutdown the log sources. */
@@ -114,13 +114,13 @@ static void CloseLogSrc(void)
}
-static enum LOGSRC GetKernelLogSrc(void)
+static enum LOGSRC GetKernelLogSrc(modConfData_t *pModConf)
{
auto struct stat sb;
/* Set level of kernel console messaging.. */
- if ( (console_log_level != -1) &&
- (ksyslog(8, NULL, console_log_level) < 0) &&
+ if ( (pModConf->console_log_level != -1) &&
+ (ksyslog(8, NULL, pModConf->console_log_level) < 0) &&
(errno == EINVAL) )
{
/*
@@ -137,8 +137,8 @@ static enum LOGSRC GetKernelLogSrc(void)
* First do a stat to determine whether or not the proc based
* file system is available to get kernel messages from.
*/
- if ( use_syscall ||
- ((stat((char*)GetPath(), &sb) < 0) && (errno == ENOENT)) )
+ if ( pModConf->use_syscall ||
+ ((stat((char*)GetPath(pModConf), &sb) < 0) && (errno == ENOENT)) )
{
/* Initialize kernel logging. */
ksyslog(1, NULL, 0);
@@ -147,14 +147,14 @@ static enum LOGSRC GetKernelLogSrc(void)
return(kernel);
}
- if ( (kmsg = open((char*)GetPath(), O_RDONLY|O_CLOEXEC)) < 0 )
+ if ( (kmsg = open((char*)GetPath(pModConf), O_RDONLY|O_CLOEXEC)) < 0 )
{
imklogLogIntMsg(LOG_ERR, "imklog: Cannot open proc file system, %d.\n", errno);
ksyslog(7, NULL, 0);
return(none);
}
- imklogLogIntMsg(LOG_INFO, "imklog %s, log source = %s started.", VERSION, GetPath());
+ imklogLogIntMsg(LOG_INFO, "imklog %s, log source = %s started.", VERSION, GetPath(pModConf));
return(proc);
}
@@ -200,7 +200,7 @@ static int copyin( uchar *line, int space,
* original text. Just in case somebody wants to run their own Oops
* analysis on the syslog, e.g. ksymoops.
*/
-static void LogLine(char *ptr, int len)
+static void LogLine(modConfData_t *pModConf, char *ptr, int len)
{
enum parse_state_enum {
PARSING_TEXT,
@@ -278,7 +278,7 @@ static void LogLine(char *ptr, int len)
Syslog(LOG_INFO, line_buff);
line = line_buff;
space = sizeof(line_buff)-1;
- if (symbols_twice) {
+ if(pModConf->symbols_twice) {
if (symbols_expanded) {
/* reprint this line without symbol lookup */
symbols_expanded = 0;
@@ -376,8 +376,7 @@ static void LogLine(char *ptr, int len)
value = strtoul((char*)(sym_start+1), (char **) 0, 16);
*(line-1) = '>'; /* put back delim */
- if ( !symbol_lookup || (symbol = LookupSymbol(value, &sym)) == (char *)0 )
- {
+ if(!pModConf->symbol_lookup || (symbol = LookupSymbol(value, &sym)) == (char *)0 ) {
parse_state = PARSING_TEXT;
break;
}
@@ -415,7 +414,7 @@ static void LogLine(char *ptr, int len)
}
-static void LogKernelLine(void)
+static void LogKernelLine(modConfData_t *pModConf)
{
auto int rdcnt;
@@ -433,12 +432,12 @@ static void LogKernelLine(void)
imklogLogIntMsg(LOG_ERR, "imklog Error return from sys_sycall: %d\n", errno);
}
else
- LogLine(log_buffer, rdcnt);
+ LogLine(pModConf, log_buffer, rdcnt);
return;
}
-static void LogProcLine(void)
+static void LogProcLine(modConfData_t *pModConf)
{
auto int rdcnt;
@@ -454,7 +453,7 @@ static void LogProcLine(void)
return;
imklogLogIntMsg(LOG_ERR, "Cannot read proc file system: %d - %s.", errno, strerror(errno));
} else {
- LogLine(log_buffer, rdcnt);
+ LogLine(pModConf, log_buffer, rdcnt);
}
return;
@@ -464,15 +463,15 @@ static void LogProcLine(void)
/* to be called in the module's WillRun entry point
* rgerhards, 2008-04-09
*/
-rsRetVal klogLogKMsg(void)
+rsRetVal klogLogKMsg(modConfData_t *pModConf)
{
DEFiRet;
switch(logsrc) {
case kernel:
- LogKernelLine();
+ LogKernelLine(pModConf);
break;
case proc:
- LogProcLine();
+ LogProcLine(pModConf);
break;
case none:
/* TODO: We need to handle this case here somewhat more intelligent
@@ -489,19 +488,19 @@ rsRetVal klogLogKMsg(void)
/* to be called in the module's WillRun entry point
* rgerhards, 2008-04-09
*/
-rsRetVal klogWillRun(void)
+rsRetVal klogWillRun(modConfData_t *pModConf)
{
DEFiRet;
/* Initialize this module. If that fails, we tell the engine we don't like to run */
/* Determine where kernel logging information is to come from. */
- logsrc = GetKernelLogSrc();
+ logsrc = GetKernelLogSrc(pModConf);
if(logsrc == none) {
iRet = RS_RET_NO_KERNEL_LOGSRC;
} else {
- if (symbol_lookup) {
- symbol_lookup = (InitKsyms(symfile) == 1);
- symbol_lookup |= InitMsyms();
- if (symbol_lookup == 0) {
+ if(pModConf->symbol_lookup) {
+ pModConf->symbol_lookup = (InitKsyms(pModConf) == 1);
+ pModConf->symbol_lookup |= InitMsyms();
+ if(pModConf->symbol_lookup == 0) {
imklogLogIntMsg(LOG_WARNING, "cannot find any symbols, turning off symbol lookups");
}
}
@@ -514,12 +513,12 @@ rsRetVal klogWillRun(void)
/* to be called in the module's AfterRun entry point
* rgerhards, 2008-04-09
*/
-rsRetVal klogAfterRun(void)
+rsRetVal klogAfterRun(modConfData_t *pModConf)
{
DEFiRet;
/* cleanup here */
if(logsrc != none)
- CloseLogSrc();
+ CloseLogSrc(pModConf);
DeinitKsyms();
DeinitMsyms();
diff --git a/plugins/imptcp/imptcp.c b/plugins/imptcp/imptcp.c
index 25936deb..713ee83c 100644
--- a/plugins/imptcp/imptcp.c
+++ b/plugins/imptcp/imptcp.c
@@ -1435,7 +1435,6 @@ BEGINmodInit()
CODESTARTmodInit
*ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
- initConfigSettings();
/* request objects we use */
CHKiRet(objUse(glbl, CORE_COMPONENT));
CHKiRet(objUse(prop, CORE_COMPONENT));