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) --- syslogd.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'syslogd.c') diff --git a/syslogd.c b/syslogd.c index b74bdb89..9cf51b34 100644 --- a/syslogd.c +++ b/syslogd.c @@ -3543,6 +3543,22 @@ static void die(int sig) remove_pid(PidFile); if(glblHadMemShortage) dbgprintf("Had memory shortage at least once during the run.\n"); + + /* de-init some modules */ + modExitIminternal(); + + /* TODO: this would also be the right place to de-init the builtin output modules. We + * do not currently do that, because the module interface does not allow for + * it. This will come some time later (it's essential with loadable modules). + * For the time being, this is a memory leak on exit, but as the process is + * terminated, we do not really bother about it. + * rgerhards, 2007-08-03 + * I have added some code now, but all that mod init/de-init should be moved to + * init, so that modules are unloaded and reloaded on HUP to. Eventually it should go + * into freeSelectors() - but that needs to be seen. -- rgerhards, 2007-08-09 + */ + modUnloadAndDestructAll(); + dbgprintf("Clean shutdown completed, bye.\n"); exit(0); /* "good" exit, this is the terminator function for rsyslog [die()] */ } @@ -6173,18 +6189,6 @@ int main(int argc, char **argv) */ mainloop(); - - /* de-init some modules */ - modExitIminternal(); - - /* TODO: this would also be the right place to de-init the builtin output modules. We - * do not currently do that, because the module interface does not allow for - * it. This will come some time later (it's essential with loadable modules). - * For the time being, this is a memory leak on exit, but as the process is - * terminated, we do not really bother about it. - * rgerhards, 2007-08-03 - */ - /* end de-init's */ die(bFinished); -- cgit