summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-07-25 10:52:47 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-07-25 10:52:47 +0000
commit36f1b6d7f97c0dd6e96c05876ee7ddeaa5a0a3d5 (patch)
tree0dc4db7ed2fd7ffa5efba0c4ee246088a91ea2ab
parenta3192ac18ed9df7d95d0c8d5795994e867c85eca (diff)
downloadrsyslog-36f1b6d7f97c0dd6e96c05876ee7ddeaa5a0a3d5.tar.gz
rsyslog-36f1b6d7f97c0dd6e96c05876ee7ddeaa5a0a3d5.tar.xz
rsyslog-36f1b6d7f97c0dd6e96c05876ee7ddeaa5a0a3d5.zip
added new function dbgPrintInstInfo() to omod interface
-rw-r--r--module-template.h23
-rw-r--r--modules.c6
-rw-r--r--modules.h1
-rw-r--r--omdiscard.c6
-rw-r--r--omfile.c24
-rw-r--r--omfwd.c6
-rw-r--r--ommysql.c6
-rw-r--r--omshell.c5
-rw-r--r--omusrmsg.c8
9 files changed, 85 insertions, 0 deletions
diff --git a/module-template.h b/module-template.h
index 843440b5..8842f7e4 100644
--- a/module-template.h
+++ b/module-template.h
@@ -100,6 +100,26 @@ static rsRetVal doAction(selector_t *f)\
return iRet;\
}
+
+/* dbgPrintInstInfo()
+ * Extra comments:
+ * Print debug information about this instance.
+ */
+#define BEGINdbgPrintInstInfo \
+static rsRetVal dbgPrintInstInfo(selector_t *f, void *pModData)\
+{\
+ rsRetVal iRet = RS_RET_OK;\
+ instanceData *pData = NULL;
+
+#define CODESTARTdbgPrintInstInfo \
+ assert(f != NULL);\
+ pData = (instanceData*) pModData;
+
+#define ENDdbgPrintInstInfo \
+ return iRet;\
+}
+
+
/* parseSelectorAct()
* Extra comments:
* try to process a selector action line. Checks if the action
@@ -121,6 +141,7 @@ static rsRetVal parseSelectorAct(uchar **pp, selector_t *f, void **ppModData)\
return iRet;\
}
+
/* queryEtryPt()
*/
#define BEGINqueryEtryPt \
@@ -150,6 +171,8 @@ static rsRetVal queryEtryPt(uchar *name, rsRetVal (**pEtryPoint)())\
*pEtryPoint = parseSelectorAct;\
} else if(!strcmp((char*) name, "isCompatibleWithFeature")) {\
*pEtryPoint = isCompatibleWithFeature;\
+ } else if(!strcmp((char*) name, "dbgPrintInstInfo")) {\
+ *pEtryPoint = dbgPrintInstInfo;\
} else if(!strcmp((char*) name, "freeInstance")) {\
*pEtryPoint = freeInstance;\
}
diff --git a/modules.c b/modules.c
index 0096cfbc..db79e4ef 100644
--- a/modules.c
+++ b/modules.c
@@ -175,6 +175,11 @@ rsRetVal doModInit(rsRetVal (*modInit)(int, int*, rsRetVal(**)()), uchar *name)
moduleDestruct(pNew);
return iRet;
}
+ if((iRet = (*pNew->modQueryEtryPt)((uchar*)"dbgPrintInstInfo",
+ &pNew->dbgPrintInstInfo)) != RS_RET_OK) {
+ moduleDestruct(pNew);
+ return iRet;
+ }
if((iRet = (*pNew->modQueryEtryPt)((uchar*)"freeInstance", &pNew->freeInstance)) != RS_RET_OK) {
moduleDestruct(pNew);
return iRet;
@@ -218,6 +223,7 @@ void modPrintList(void)
dprintf("\tqueryEtryPt: 0x%x\n", (unsigned) pMod->modQueryEtryPt);
dprintf("\tdoAction: 0x%x\n", (unsigned) pMod->mod.om.doAction);
dprintf("\tparseSelectorAct: 0x%x\n", (unsigned) pMod->mod.om.parseSelectorAct);
+ dprintf("\tdbgPrintInstInfo: 0x%x\n", (unsigned) pMod->dbgPrintInstInfo);
dprintf("\tfreeInstance: 0x%x\n", (unsigned) pMod->freeInstance);
dprintf("\n");
pMod = modGetNxt(pMod); /* done, go next */
diff --git a/modules.h b/modules.h
index 46179d73..476a7e76 100644
--- a/modules.h
+++ b/modules.h
@@ -55,6 +55,7 @@ typedef struct moduleInfo {
rsRetVal (*modQueryEtryPt)(uchar *name, rsRetVal (**EtryPoint)()); /* query entry point addresses */
rsRetVal (*isCompatibleWithFeature)(syslogFeature);
rsRetVal (*freeInstance)(struct filed*, void*);/* called before termination or module unload */
+ rsRetVal (*dbgPrintInstInfo)(struct filed*, void*);/* called before termination or module unload */
rsRetVal (*modExit)(); /* called before termination or module unload */
/* below: parse a configuration line - return if processed
* or not. If not, must be parsed to next module.
diff --git a/omdiscard.c b/omdiscard.c
index 8153d7e1..6b4034ab 100644
--- a/omdiscard.c
+++ b/omdiscard.c
@@ -45,6 +45,12 @@ ENDcreateInstance
*/
+BEGINdbgPrintInstInfo
+CODESTARTdbgPrintInstInfo
+ /* do nothing */
+ENDdbgPrintInstInfo
+
+
BEGINisCompatibleWithFeature
CODESTARTisCompatibleWithFeature
/* we are not compatible with repeated msg reduction feature, so do not allow it */
diff --git a/omfile.c b/omfile.c
index 016b1402..d0db334e 100644
--- a/omfile.c
+++ b/omfile.c
@@ -61,6 +61,30 @@ CODESTARTisCompatibleWithFeature
ENDisCompatibleWithFeature
+BEGINdbgPrintInstInfo
+CODESTARTdbgPrintInstInfo
+ if(f->f_un.f_file.bDynamicName) {
+ printf("[dynamic]\n\ttemplate='%s'\n"
+ "\tfile cache size=%d\n"
+ "\tcreate directories: %s\n"
+ "\tfile owner %d, group %d\n"
+ "\tdirectory owner %d, group %d\n"
+ "\tfail if owner/group can not be set: %s\n",
+ f->f_un.f_file.f_fname,
+ f->f_un.f_file.iDynaFileCacheSize,
+ f->f_un.f_file.bCreateDirs ? "yes" : "no",
+ f->f_un.f_file.fileUID, f->f_un.f_file.fileGID,
+ f->f_un.f_file.dirUID, f->f_un.f_file.dirGID,
+ f->f_un.f_file.bFailOnChown ? "yes" : "no"
+ );
+ } else { /* regular file */
+ printf("%s", f->f_un.f_file.f_fname);
+ if (f->f_file == -1)
+ printf(" (unused)");
+ }
+ENDdbgPrintInstInfo
+
+
/* Helper to cfline(). Parses a output channel name up until the first
* comma and then looks for the template specifier. Tries
* to find that template. Maps the output channel to the
diff --git a/omfwd.c b/omfwd.c
index e1b20464..0b1db927 100644
--- a/omfwd.c
+++ b/omfwd.c
@@ -99,6 +99,12 @@ CODESTARTfreeInstance
ENDfreeInstance
+BEGINdbgPrintInstInfo
+CODESTARTdbgPrintInstInfo
+ printf("%s", f->f_un.f_forw.f_hname);
+ENDdbgPrintInstInfo
+
+
BEGINdoAction
char *psz; /* temporary buffering */
register unsigned l;
diff --git a/ommysql.c b/ommysql.c
index dfa1a283..61691cca 100644
--- a/ommysql.c
+++ b/ommysql.c
@@ -73,6 +73,12 @@ CODESTARTfreeInstance
ENDfreeInstance
+BEGINdbgPrintInstInfo
+CODESTARTdbgPrintInstInfo
+ /* nothing special here */
+ENDdbgPrintInstInfo
+
+
static rsRetVal reInitMySQL(register selector_t *f);
diff --git a/omshell.c b/omshell.c
index 503372e5..af4e28c6 100644
--- a/omshell.c
+++ b/omshell.c
@@ -64,6 +64,11 @@ CODESTARTfreeInstance
ENDfreeInstance
+BEGINdbgPrintInstInfo
+CODESTARTdbgPrintInstInfo
+ printf("%s", f->f_un.f_file.f_fname);
+ENDdbgPrintInstInfo
+
BEGINdoAction
uchar *psz;
diff --git a/omusrmsg.c b/omusrmsg.c
index 43b6ebe2..0d848eb2 100644
--- a/omusrmsg.c
+++ b/omusrmsg.c
@@ -76,6 +76,14 @@ CODESTARTfreeInstance
ENDfreeInstance
+BEGINdbgPrintInstInfo
+ register int i;
+CODESTARTdbgPrintInstInfo
+ for (i = 0; i < MAXUNAMES && *f->f_un.f_uname[i]; i++)
+ printf("%s, ", f->f_un.f_uname[i]);
+ENDdbgPrintInstInfo
+
+
static jmp_buf ttybuf;
static void endtty()