From 3bb7ad8246bca95c89d68a8b0402b8482489c877 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 21 Nov 2007 16:34:48 +0000 Subject: - added an identifier to command handler table - need to identify which command handler entries need to be removed when module is unloaded - added support so that linkedlist key can be used for owner handle - enhanced llExecFunc to support deletion of list elements (on behalf of user function being called, slight interface change) - enhanced linkedlist class so that list elements can now be deleted based on the key value they have - created entry point so that CfSysLine handlers are removed on modExit() --- modules.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'modules.c') diff --git a/modules.c b/modules.c index e997eb40..b7ba6dd8 100644 --- a/modules.c +++ b/modules.c @@ -184,6 +184,7 @@ modInfo_t *omodGetNxt(modInfo_t *pThis) static rsRetVal modUnload(modInfo_t *pThis) { DEFiRet; + void *pModCookie; assert(pThis != NULL); @@ -192,7 +193,9 @@ static rsRetVal modUnload(modInfo_t *pThis) * CVS snapshot, be aware of this limitation. For now, you can just remove everything up to * (but not including) the END DEVEL comment. That will do the trick. rgerhards, 2007-11-21 */ -dbgprintf("we are now calling modExit()\n"); + CHKiRet(pThis->modGetID(&pModCookie)); +dbgprintf("we are now calling modExit(), module id %x\n", pModCookie); + CHKiRet(unregCfSysLineHdlrs4Owner(pModCookie)); /* END DEVEL */ @@ -283,6 +286,10 @@ rsRetVal doModInit(rsRetVal (*modInit)(int, int*, rsRetVal(**)(), rsRetVal(*)()) moduleDestruct(pNew); return iRet; } + if((iRet = (*pNew->modQueryEtryPt)((uchar*)"modGetID", &pNew->modGetID)) != RS_RET_OK) { + moduleDestruct(pNew); + return iRet; + } if((iRet = (*pNew->modQueryEtryPt)((uchar*)"modExit", &pNew->modExit)) != RS_RET_OK) { moduleDestruct(pNew); return iRet; -- cgit