From de00dd2a7ea6202c2f154f2e3f4fd54e3cac32cc Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 9 Aug 2007 13:44:36 +0000 Subject: added module unload functionality; rsyslogd now unloads modules on exit (of course, with only statically linked modules, there is little current value in this - but it is made towards an upcoming dynaload plugin interface) --- modules.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'modules.c') diff --git a/modules.c b/modules.c index 01bba104..5ecceecd 100644 --- a/modules.c +++ b/modules.c @@ -308,6 +308,27 @@ void modPrintList(void) } +/* unload all modules and free module linked list + * rgerhards, 2007-08-09 + */ +rsRetVal modUnloadAndDestructAll(void) +{ + DEFiRet; + modInfo_t *pMod; + modInfo_t *pModPrev; + + pMod = modGetNxt(NULL); + while(pMod != NULL) { + pModPrev = pMod; + pMod = modGetNxt(pModPrev); /* get next */ + /* now we can destroy the previous module */ + dbgprintf("Unloading module %s\n", modGetName(pModPrev)); + modUnload(pModPrev); + moduleDestruct(pModPrev); + } + + return iRet; +} /* * vi:set ai: */ -- cgit