summaryrefslogtreecommitdiffstats
path: root/cfsysline.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-11-21 10:52:19 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-11-21 10:52:19 +0000
commit8d606ea26d5fc79b845bafbc08d979ecc2ba0529 (patch)
treef17916ff1579340b723b9253cdab6d117697ab37 /cfsysline.c
parent214c7bd7f8552f0a07a15373b4a222da6e9e6ba6 (diff)
downloadrsyslog-8d606ea26d5fc79b845bafbc08d979ecc2ba0529.tar.gz
rsyslog-8d606ea26d5fc79b845bafbc08d979ecc2ba0529.tar.xz
rsyslog-8d606ea26d5fc79b845bafbc08d979ecc2ba0529.zip
added an identifier to command handler table - need to identify which
command handler entries need to be removed when module is unloaded
Diffstat (limited to 'cfsysline.c')
-rw-r--r--cfsysline.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/cfsysline.c b/cfsysline.c
index 8a61c7ef..56ed925e 100644
--- a/cfsysline.c
+++ b/cfsysline.c
@@ -434,7 +434,7 @@ finalize_it:
/* set data members for this object
*/
-rsRetVal cslchSetEntry(cslCmdHdlr_t *pThis, ecslCmdHdrlType eType, rsRetVal (*pHdlr)(), void *pData)
+rsRetVal cslchSetEntry(cslCmdHdlr_t *pThis, ecslCmdHdrlType eType, rsRetVal (*pHdlr)(), void *pData, void *pOwnerCookie)
{
assert(pThis != NULL);
assert(eType != eCmdHdlrInvalid);
@@ -442,6 +442,8 @@ rsRetVal cslchSetEntry(cslCmdHdlr_t *pThis, ecslCmdHdrlType eType, rsRetVal (*pH
pThis->eType = eType;
pThis->cslCmdHdlr = pHdlr;
pThis->pData = pData;
+ pThis->pOwnerCookie = pOwnerCookie;
+dbgprintf("handler owner cookie %x\n", pOwnerCookie);
return RS_RET_OK;
}
@@ -546,7 +548,7 @@ finalize_it:
/* add a handler entry to a known command
*/
-static rsRetVal cslcAddHdlr(cslCmd_t *pThis, ecslCmdHdrlType eType, rsRetVal (*pHdlr)(), void *pData)
+static rsRetVal cslcAddHdlr(cslCmd_t *pThis, ecslCmdHdrlType eType, rsRetVal (*pHdlr)(), void *pData, void *pOwnerCookie)
{
DEFiRet;
cslCmdHdlr_t *pCmdHdlr = NULL;
@@ -554,7 +556,7 @@ static rsRetVal cslcAddHdlr(cslCmd_t *pThis, ecslCmdHdrlType eType, rsRetVal (*p
assert(pThis != NULL);
CHKiRet(cslchConstruct(&pCmdHdlr));
- CHKiRet(cslchSetEntry(pCmdHdlr, eType, pHdlr, pData));
+ CHKiRet(cslchSetEntry(pCmdHdlr, eType, pHdlr, pData, pOwnerCookie));
CHKiRet(llAppend(&pThis->llCmdHdlrs, NULL, pCmdHdlr));
finalize_it:
@@ -587,7 +589,8 @@ finalize_it:
* caller does not need to take care of that. The caller must, however,
* free pCmdName if he allocated it dynamically! -- rgerhards, 2007-08-09
*/
-rsRetVal regCfSysLineHdlr(uchar *pCmdName, int bChainingPermitted, ecslCmdHdrlType eType, rsRetVal (*pHdlr)(), void *pData)
+rsRetVal regCfSysLineHdlr(uchar *pCmdName, int bChainingPermitted, ecslCmdHdrlType eType, rsRetVal (*pHdlr)(), void *pData,
+ void *pOwnerCookie)
{
cslCmd_t *pThis;
uchar *pMyCmdName;
@@ -597,7 +600,7 @@ rsRetVal regCfSysLineHdlr(uchar *pCmdName, int bChainingPermitted, ecslCmdHdrlTy
if(iRet == RS_RET_NOT_FOUND) {
/* new command */
CHKiRet(cslcConstruct(&pThis, bChainingPermitted));
- CHKiRet_Hdlr(cslcAddHdlr(pThis, eType, pHdlr, pData)) {
+ CHKiRet_Hdlr(cslcAddHdlr(pThis, eType, pHdlr, pData, pOwnerCookie)) {
cslcDestruct(pThis);
goto finalize_it;
}
@@ -617,7 +620,7 @@ rsRetVal regCfSysLineHdlr(uchar *pCmdName, int bChainingPermitted, ecslCmdHdrlTy
if(pThis->bChainingPermitted == 0 || bChainingPermitted == 0) {
ABORT_FINALIZE(RS_RET_CHAIN_NOT_PERMITTED);
}
- CHKiRet_Hdlr(cslcAddHdlr(pThis, eType, pHdlr, pData)) {
+ CHKiRet_Hdlr(cslcAddHdlr(pThis, eType, pHdlr, pData, pOwnerCookie)) {
cslcDestruct(pThis);
goto finalize_it;
}
@@ -710,6 +713,7 @@ void dbgPrintCfSysLineHandlers(void)
printf("\t\ttype : %d\n", pCmdHdlr->eType);
printf("\t\tpData: 0x%x\n", (unsigned) pCmdHdlr->pData);
printf("\t\tHdlr : 0x%x\n", (unsigned) pCmdHdlr->cslCmdHdlr);
+ printf("\t\tOwner: 0x%x\n", (unsigned) pCmdHdlr->pOwnerCookie);
printf("\n");
}
}