diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2007-07-25 10:52:47 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2007-07-25 10:52:47 +0000 |
commit | 36f1b6d7f97c0dd6e96c05876ee7ddeaa5a0a3d5 (patch) | |
tree | 0dc4db7ed2fd7ffa5efba0c4ee246088a91ea2ab | |
parent | a3192ac18ed9df7d95d0c8d5795994e867c85eca (diff) | |
download | rsyslog-36f1b6d7f97c0dd6e96c05876ee7ddeaa5a0a3d5.tar.gz rsyslog-36f1b6d7f97c0dd6e96c05876ee7ddeaa5a0a3d5.tar.xz rsyslog-36f1b6d7f97c0dd6e96c05876ee7ddeaa5a0a3d5.zip |
added new function dbgPrintInstInfo() to omod interface
-rw-r--r-- | module-template.h | 23 | ||||
-rw-r--r-- | modules.c | 6 | ||||
-rw-r--r-- | modules.h | 1 | ||||
-rw-r--r-- | omdiscard.c | 6 | ||||
-rw-r--r-- | omfile.c | 24 | ||||
-rw-r--r-- | omfwd.c | 6 | ||||
-rw-r--r-- | ommysql.c | 6 | ||||
-rw-r--r-- | omshell.c | 5 | ||||
-rw-r--r-- | omusrmsg.c | 8 |
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;\ } @@ -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 */ @@ -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 */ @@ -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 @@ -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; @@ -73,6 +73,12 @@ CODESTARTfreeInstance ENDfreeInstance +BEGINdbgPrintInstInfo +CODESTARTdbgPrintInstInfo + /* nothing special here */ +ENDdbgPrintInstInfo + + static rsRetVal reInitMySQL(register selector_t *f); @@ -64,6 +64,11 @@ CODESTARTfreeInstance ENDfreeInstance +BEGINdbgPrintInstInfo +CODESTARTdbgPrintInstInfo + printf("%s", f->f_un.f_file.f_fname); +ENDdbgPrintInstInfo + BEGINdoAction uchar *psz; @@ -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() |