summaryrefslogtreecommitdiffstats
path: root/modules.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-08-09 13:44:36 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-08-09 13:44:36 +0000
commitde00dd2a7ea6202c2f154f2e3f4fd54e3cac32cc (patch)
treec22718da0c2e38b6c072f0d495e90adc027615aa /modules.c
parent16a59b29b76b6266cfcca3c4aa748f85306b650c (diff)
downloadrsyslog-de00dd2a7ea6202c2f154f2e3f4fd54e3cac32cc.tar.gz
rsyslog-de00dd2a7ea6202c2f154f2e3f4fd54e3cac32cc.tar.xz
rsyslog-de00dd2a7ea6202c2f154f2e3f4fd54e3cac32cc.zip
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)
Diffstat (limited to 'modules.c')
-rw-r--r--modules.c21
1 files changed, 21 insertions, 0 deletions
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:
*/