summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBojan Smojver <bojan@rexursive.com>2011-02-23 11:25:43 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2011-02-23 11:25:43 +0100
commitd1eb6e0edc51a78f3209448e800b25eda50340f2 (patch)
tree6d81c1de98eb0c77affaa2f112b5a0628f54ebc3
parentee065f1cb55be56da6ed12b35cd0e686abcb3a10 (diff)
downloadrsyslog-d1eb6e0edc51a78f3209448e800b25eda50340f2.zip
rsyslog-d1eb6e0edc51a78f3209448e800b25eda50340f2.tar.gz
rsyslog-d1eb6e0edc51a78f3209448e800b25eda50340f2.tar.xz
added work-around for bug in gtls, which causes fd leak when using TLS
The capability has been added for module to specify that they do not like being unloaded. related bug tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=222 Signed-off-by: Rainer Gerhards <rgerhards@adiscon.com>
-rw-r--r--gss-misc.c1
-rw-r--r--plugins/im3195/im3195.c1
-rw-r--r--plugins/imdiag/imdiag.c1
-rw-r--r--plugins/imfile/imfile.c1
-rw-r--r--plugins/imgssapi/imgssapi.c1
-rw-r--r--plugins/imklog/imklog.c1
-rw-r--r--plugins/immark/immark.c1
-rw-r--r--plugins/imptcp/imptcp.c1
-rw-r--r--plugins/imrelp/imrelp.c1
-rw-r--r--plugins/imsolaris/imsolaris.c1
-rw-r--r--plugins/imtcp/imtcp.c1
-rw-r--r--plugins/imtemplate/imtemplate.c1
-rw-r--r--plugins/imudp/imudp.c1
-rw-r--r--plugins/imuxsock/imuxsock.c1
-rw-r--r--plugins/omdbalerting/omdbalerting.c1
-rw-r--r--plugins/omgssapi/omgssapi.c1
-rw-r--r--plugins/omlibdbi/omlibdbi.c1
-rw-r--r--plugins/ommail/ommail.c1
-rw-r--r--plugins/ommysql/ommysql.c1
-rw-r--r--plugins/omoracle/omoracle.c1
-rw-r--r--plugins/ompgsql/ompgsql.c1
-rw-r--r--plugins/omprog/omprog.c1
-rw-r--r--plugins/omrelp/omrelp.c1
-rw-r--r--plugins/omruleset/omruleset.c1
-rw-r--r--plugins/omsnmp/omsnmp.c1
-rw-r--r--plugins/omstdout/omstdout.c1
-rw-r--r--plugins/omtemplate/omtemplate.c1
-rw-r--r--plugins/omtesting/omtesting.c1
-rw-r--r--plugins/omudpspoof/omudpspoof.c1
-rw-r--r--plugins/omuxsock/omuxsock.c1
-rw-r--r--plugins/pmlastmsg/pmlastmsg.c1
-rw-r--r--plugins/pmrfc3164sd/pmrfc3164sd.c1
-rw-r--r--runtime/module-template.h12
-rw-r--r--runtime/modules.c48
-rw-r--r--runtime/modules.h14
-rw-r--r--runtime/net.c1
-rw-r--r--runtime/netstrms.c1
-rw-r--r--runtime/nsd_gtls.c1
-rw-r--r--runtime/nsd_ptcp.c1
-rw-r--r--runtime/regexp.c1
-rw-r--r--runtime/strmsrv.c1
-rw-r--r--runtime/zlibw.c1
-rw-r--r--tcpclt.c1
-rw-r--r--tcpsrv.c1
-rw-r--r--tests/rt-init.c1
-rw-r--r--tools/omdiscard.c1
-rw-r--r--tools/omfile.c1
-rw-r--r--tools/omfwd.c1
-rw-r--r--tools/ompipe.c1
-rw-r--r--tools/omshell.c1
-rw-r--r--tools/omusrmsg.c1
-rw-r--r--tools/pmrfc3164.c1
-rw-r--r--tools/pmrfc5424.c1
-rw-r--r--tools/smfile.c1
-rw-r--r--tools/smfwd.c1
-rw-r--r--tools/smtradfile.c1
-rw-r--r--tools/smtradfwd.c1
57 files changed, 123 insertions, 5 deletions
diff --git a/gss-misc.c b/gss-misc.c
index a5e161d..d30eda0 100644
--- a/gss-misc.c
+++ b/gss-misc.c
@@ -56,6 +56,7 @@
#include "unlimited_select.h"
MODULE_TYPE_LIB
+MODULE_TYPE_NOKEEP
/* static data */
DEFobjStaticHelpers
diff --git a/plugins/im3195/im3195.c b/plugins/im3195/im3195.c
index 106da2c..156524c 100644
--- a/plugins/im3195/im3195.c
+++ b/plugins/im3195/im3195.c
@@ -51,6 +51,7 @@
#include "errmsg.h"
MODULE_TYPE_INPUT
+MODULE_TYPE_NOKEEP
/* Module static data */
DEF_IMOD_STATIC_DATA
diff --git a/plugins/imdiag/imdiag.c b/plugins/imdiag/imdiag.c
index 81b357e..b7a2a07 100644
--- a/plugins/imdiag/imdiag.c
+++ b/plugins/imdiag/imdiag.c
@@ -57,6 +57,7 @@
#include "net.h" /* for permittedPeers, may be removed when this is removed */
MODULE_TYPE_INPUT
+MODULE_TYPE_NOKEEP
/* static data */
DEF_IMOD_STATIC_DATA
diff --git a/plugins/imfile/imfile.c b/plugins/imfile/imfile.c
index 1dd5e65..acb58da 100644
--- a/plugins/imfile/imfile.c
+++ b/plugins/imfile/imfile.c
@@ -51,6 +51,7 @@
#include "ruleset.h"
MODULE_TYPE_INPUT /* must be present for input modules, do not remove */
+MODULE_TYPE_NOKEEP
/* defines */
diff --git a/plugins/imgssapi/imgssapi.c b/plugins/imgssapi/imgssapi.c
index dd3d67e..446795d 100644
--- a/plugins/imgssapi/imgssapi.c
+++ b/plugins/imgssapi/imgssapi.c
@@ -62,6 +62,7 @@
MODULE_TYPE_INPUT
+MODULE_TYPE_NOKEEP
/* defines */
#define ALLOWEDMETHOD_GSS 2
diff --git a/plugins/imklog/imklog.c b/plugins/imklog/imklog.c
index c59ce04..69c8cd1 100644
--- a/plugins/imklog/imklog.c
+++ b/plugins/imklog/imklog.c
@@ -58,6 +58,7 @@
#include "unicode-helper.h"
MODULE_TYPE_INPUT
+MODULE_TYPE_NOKEEP
/* Module static data */
DEF_IMOD_STATIC_DATA
diff --git a/plugins/immark/immark.c b/plugins/immark/immark.c
index 5d48369..6410003 100644
--- a/plugins/immark/immark.c
+++ b/plugins/immark/immark.c
@@ -46,6 +46,7 @@
#include "glbl.h"
MODULE_TYPE_INPUT
+MODULE_TYPE_NOKEEP
/* defines */
#define DEFAULT_MARK_PERIOD (20 * 60)
diff --git a/plugins/imptcp/imptcp.c b/plugins/imptcp/imptcp.c
index 6449ad6..3197564 100644
--- a/plugins/imptcp/imptcp.c
+++ b/plugins/imptcp/imptcp.c
@@ -73,6 +73,7 @@
MODULE_TYPE_INPUT
+MODULE_TYPE_NOKEEP
/* static data */
DEF_IMOD_STATIC_DATA
diff --git a/plugins/imrelp/imrelp.c b/plugins/imrelp/imrelp.c
index 9be38f8..13fd442 100644
--- a/plugins/imrelp/imrelp.c
+++ b/plugins/imrelp/imrelp.c
@@ -47,6 +47,7 @@
#include "prop.h"
MODULE_TYPE_INPUT
+MODULE_TYPE_NOKEEP
/* static data */
DEF_IMOD_STATIC_DATA
diff --git a/plugins/imsolaris/imsolaris.c b/plugins/imsolaris/imsolaris.c
index f801833..ee9ec5c 100644
--- a/plugins/imsolaris/imsolaris.c
+++ b/plugins/imsolaris/imsolaris.c
@@ -85,6 +85,7 @@
#include "sun_cddl.h"
MODULE_TYPE_INPUT
+MODULE_TYPE_NOKEEP
/* defines */
#define PATH_LOG "/dev/log"
diff --git a/plugins/imtcp/imtcp.c b/plugins/imtcp/imtcp.c
index 0cfae05..d3e9cab 100644
--- a/plugins/imtcp/imtcp.c
+++ b/plugins/imtcp/imtcp.c
@@ -65,6 +65,7 @@
#include "net.h" /* for permittedPeers, may be removed when this is removed */
MODULE_TYPE_INPUT
+MODULE_TYPE_NOKEEP
/* static data */
DEF_IMOD_STATIC_DATA
diff --git a/plugins/imtemplate/imtemplate.c b/plugins/imtemplate/imtemplate.c
index e5e4302..0e2cac1 100644
--- a/plugins/imtemplate/imtemplate.c
+++ b/plugins/imtemplate/imtemplate.c
@@ -80,6 +80,7 @@
#include "debug.h" /* some debug helper functions */
MODULE_TYPE_INPUT /* must be present for input modules, do not remove */
+MODULE_TYPE_NOKEEP
/* defines */
diff --git a/plugins/imudp/imudp.c b/plugins/imudp/imudp.c
index ad39ead..56cdab2 100644
--- a/plugins/imudp/imudp.c
+++ b/plugins/imudp/imudp.c
@@ -54,6 +54,7 @@
#include "unicode-helper.h"
MODULE_TYPE_INPUT
+MODULE_TYPE_NOKEEP
/* defines */
diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c
index ff38852..40f32e4 100644
--- a/plugins/imuxsock/imuxsock.c
+++ b/plugins/imuxsock/imuxsock.c
@@ -56,6 +56,7 @@
#include "hashtable.h"
MODULE_TYPE_INPUT
+MODULE_TYPE_NOKEEP
/* defines */
#define MAXFUNIX 50
diff --git a/plugins/omdbalerting/omdbalerting.c b/plugins/omdbalerting/omdbalerting.c
index 2e04391..35de581 100644
--- a/plugins/omdbalerting/omdbalerting.c
+++ b/plugins/omdbalerting/omdbalerting.c
@@ -44,6 +44,7 @@
#include "cfsysline.h"
MODULE_TYPE_OUTPUT
+MODULE_TYPE_NOKEEP
/* internal structures
*/
diff --git a/plugins/omgssapi/omgssapi.c b/plugins/omgssapi/omgssapi.c
index 605e5ed..e4fdf0c 100644
--- a/plugins/omgssapi/omgssapi.c
+++ b/plugins/omgssapi/omgssapi.c
@@ -58,6 +58,7 @@
#include "errmsg.h"
MODULE_TYPE_OUTPUT
+MODULE_TYPE_NOKEEP
/* internal structures
diff --git a/plugins/omlibdbi/omlibdbi.c b/plugins/omlibdbi/omlibdbi.c
index 6f130f5..4b190ce 100644
--- a/plugins/omlibdbi/omlibdbi.c
+++ b/plugins/omlibdbi/omlibdbi.c
@@ -50,6 +50,7 @@
#include "errmsg.h"
MODULE_TYPE_OUTPUT
+MODULE_TYPE_NOKEEP
/* internal structures
*/
diff --git a/plugins/ommail/ommail.c b/plugins/ommail/ommail.c
index 324e1a7..886513c 100644
--- a/plugins/ommail/ommail.c
+++ b/plugins/ommail/ommail.c
@@ -54,6 +54,7 @@
#include "glbl.h"
MODULE_TYPE_OUTPUT
+MODULE_TYPE_NOKEEP
/* internal structures
*/
diff --git a/plugins/ommysql/ommysql.c b/plugins/ommysql/ommysql.c
index aff76d0..f8bb4aa 100644
--- a/plugins/ommysql/ommysql.c
+++ b/plugins/ommysql/ommysql.c
@@ -46,6 +46,7 @@
#include "cfsysline.h"
MODULE_TYPE_OUTPUT
+MODULE_TYPE_NOKEEP
/* internal structures
*/
diff --git a/plugins/omoracle/omoracle.c b/plugins/omoracle/omoracle.c
index 30b5834..a37533e 100644
--- a/plugins/omoracle/omoracle.c
+++ b/plugins/omoracle/omoracle.c
@@ -82,6 +82,7 @@
#include "omoracle.h"
MODULE_TYPE_OUTPUT
+MODULE_TYPE_NOKEEP
/** */
DEF_OMOD_STATIC_DATA
diff --git a/plugins/ompgsql/ompgsql.c b/plugins/ompgsql/ompgsql.c
index ffdcc53..ab8e4d2 100644
--- a/plugins/ompgsql/ompgsql.c
+++ b/plugins/ompgsql/ompgsql.c
@@ -49,6 +49,7 @@
#include "errmsg.h"
MODULE_TYPE_OUTPUT
+MODULE_TYPE_NOKEEP
/* internal structures
*/
diff --git a/plugins/omprog/omprog.c b/plugins/omprog/omprog.c
index 2687e7a..5619257 100644
--- a/plugins/omprog/omprog.c
+++ b/plugins/omprog/omprog.c
@@ -45,6 +45,7 @@
#include "cfsysline.h"
MODULE_TYPE_OUTPUT
+MODULE_TYPE_NOKEEP
/* internal structures
*/
diff --git a/plugins/omrelp/omrelp.c b/plugins/omrelp/omrelp.c
index 349e45a..cf70381 100644
--- a/plugins/omrelp/omrelp.c
+++ b/plugins/omrelp/omrelp.c
@@ -46,6 +46,7 @@
#include "debug.h"
MODULE_TYPE_OUTPUT
+MODULE_TYPE_NOKEEP
/* internal structures
*/
diff --git a/plugins/omruleset/omruleset.c b/plugins/omruleset/omruleset.c
index 0e0fc13..c439bd8 100644
--- a/plugins/omruleset/omruleset.c
+++ b/plugins/omruleset/omruleset.c
@@ -49,6 +49,7 @@
#include "dirty.h"
MODULE_TYPE_OUTPUT
+MODULE_TYPE_NOKEEP
/* static data */
DEFobjCurrIf(ruleset);
diff --git a/plugins/omsnmp/omsnmp.c b/plugins/omsnmp/omsnmp.c
index b973b09..443cfaa 100644
--- a/plugins/omsnmp/omsnmp.c
+++ b/plugins/omsnmp/omsnmp.c
@@ -47,6 +47,7 @@
#include "errmsg.h"
MODULE_TYPE_OUTPUT
+MODULE_TYPE_NOKEEP
/* internal structures
*/
diff --git a/plugins/omstdout/omstdout.c b/plugins/omstdout/omstdout.c
index 929de70..dc9912e 100644
--- a/plugins/omstdout/omstdout.c
+++ b/plugins/omstdout/omstdout.c
@@ -44,6 +44,7 @@
#include "cfsysline.h"
MODULE_TYPE_OUTPUT
+MODULE_TYPE_NOKEEP
/* internal structures
*/
diff --git a/plugins/omtemplate/omtemplate.c b/plugins/omtemplate/omtemplate.c
index 5577f8c..1472ebe 100644
--- a/plugins/omtemplate/omtemplate.c
+++ b/plugins/omtemplate/omtemplate.c
@@ -45,6 +45,7 @@
#include "cfsysline.h"
MODULE_TYPE_OUTPUT
+MODULE_TYPE_NOKEEP
/* internal structures
*/
diff --git a/plugins/omtesting/omtesting.c b/plugins/omtesting/omtesting.c
index c474bb4..6d17846 100644
--- a/plugins/omtesting/omtesting.c
+++ b/plugins/omtesting/omtesting.c
@@ -57,6 +57,7 @@
#include "cfsysline.h"
MODULE_TYPE_OUTPUT
+MODULE_TYPE_NOKEEP
/* internal structures
*/
diff --git a/plugins/omudpspoof/omudpspoof.c b/plugins/omudpspoof/omudpspoof.c
index 3ead544..48d7a68 100644
--- a/plugins/omudpspoof/omudpspoof.c
+++ b/plugins/omudpspoof/omudpspoof.c
@@ -82,6 +82,7 @@
MODULE_TYPE_OUTPUT
+MODULE_TYPE_NOKEEP
/* internal structures
*/
diff --git a/plugins/omuxsock/omuxsock.c b/plugins/omuxsock/omuxsock.c
index c66e63a..0e336c5 100644
--- a/plugins/omuxsock/omuxsock.c
+++ b/plugins/omuxsock/omuxsock.c
@@ -52,6 +52,7 @@
#include "unicode-helper.h"
MODULE_TYPE_OUTPUT
+MODULE_TYPE_NOKEEP
/* internal structures
*/
diff --git a/plugins/pmlastmsg/pmlastmsg.c b/plugins/pmlastmsg/pmlastmsg.c
index 275f1c1..259c5d4 100644
--- a/plugins/pmlastmsg/pmlastmsg.c
+++ b/plugins/pmlastmsg/pmlastmsg.c
@@ -47,6 +47,7 @@
#include "unicode-helper.h"
MODULE_TYPE_PARSER
+MODULE_TYPE_NOKEEP
PARSER_NAME("rsyslog.lastline")
/* internal structures
diff --git a/plugins/pmrfc3164sd/pmrfc3164sd.c b/plugins/pmrfc3164sd/pmrfc3164sd.c
index 5598c02..53204ec 100644
--- a/plugins/pmrfc3164sd/pmrfc3164sd.c
+++ b/plugins/pmrfc3164sd/pmrfc3164sd.c
@@ -45,6 +45,7 @@
#include "unicode-helper.h"
MODULE_TYPE_PARSER
+MODULE_TYPE_NOKEEP
PARSER_NAME("contrib.rfc3164sd")
/* internal structures
diff --git a/runtime/module-template.h b/runtime/module-template.h
index d05ec23..c2585e6 100644
--- a/runtime/module-template.h
+++ b/runtime/module-template.h
@@ -77,6 +77,16 @@ static rsRetVal modGetType(eModType_t *modType) \
DEF_LMOD_STATIC_DATA \
MODULE_TYPE(eMOD_LIB)
+/* Macro to define whether the module should be kept dynamically linked.
+ */
+#define MODULE_KEEP_TYPE(x)\
+static rsRetVal modGetKeepType(eModKeepType_t *modKeepType) \
+ { \
+ *modKeepType = x; \
+ return RS_RET_OK;\
+ }
+#define MODULE_TYPE_NOKEEP MODULE_KEEP_TYPE(eMOD_NOKEEP)
+#define MODULE_TYPE_KEEP MODULE_KEEP_TYPE(eMOD_KEEP)
/* macro to define a unique module id. This must be able to fit in a void*. The
* module id must be unique inside a running rsyslogd application. It is used to
@@ -342,6 +352,8 @@ static rsRetVal queryEtryPt(uchar *name, rsRetVal (**pEtryPoint)())\
*pEtryPoint = modGetID;\
} else if(!strcmp((char*) name, "getType")) {\
*pEtryPoint = modGetType;\
+ } else if(!strcmp((char*) name, "getKeepType")) {\
+ *pEtryPoint = modGetKeepType;\
}
/* the following definition is the standard block for queryEtryPt for output
diff --git a/runtime/modules.c b/runtime/modules.c
index d736275..86e7c69 100644
--- a/runtime/modules.c
+++ b/runtime/modules.c
@@ -77,6 +77,9 @@ static pthread_mutex_t mutLoadUnload;
static modInfo_t *pLoadedModules = NULL; /* list of currently-loaded modules */
static modInfo_t *pLoadedModulesLast = NULL; /* tail-pointer */
+/* already dlopen()-ed libs */
+static struct dlhandle_s *pHandles = NULL;
+
/* config settings */
uchar *pModDir = NULL; /* read-only after startup */
@@ -232,7 +235,9 @@ static void moduleDestruct(modInfo_t *pThis)
# ifdef VALGRIND
# warning "dlclose disabled for valgrind"
# else
- dlclose(pThis->pModHdlr);
+ if (pThis->eKeepType == eMOD_NOKEEP) {
+ dlclose(pThis->pModHdlr);
+ }
# endif
}
@@ -413,6 +418,8 @@ doModInit(rsRetVal (*modInit)(int, int*, rsRetVal(**)(), rsRetVal(*)(), modInfo_
strgen_t *pStrgen; /* used for strgen modules */
rsRetVal (*GetName)(uchar**);
rsRetVal (*modGetType)(eModType_t *pType);
+ rsRetVal (*modGetKeepType)(eModKeepType_t *pKeepType);
+ struct dlhandle_s *pHandle = NULL;
DEFiRet;
assert(modInit != NULL);
@@ -433,6 +440,8 @@ doModInit(rsRetVal (*modInit)(int, int*, rsRetVal(**)(), rsRetVal(*)(), modInfo_
*/
CHKiRet((*pNew->modQueryEtryPt)((uchar*)"getType", &modGetType));
CHKiRet((*modGetType)(&pNew->eType));
+ CHKiRet((*pNew->modQueryEtryPt)((uchar*)"getKeepType", &modGetKeepType));
+ CHKiRet((*modGetKeepType)(&pNew->eKeepType));
dbgprintf("module of type %d being loaded.\n", pNew->eType);
/* OK, we know we can successfully work with the module. So we now fill the
@@ -529,11 +538,28 @@ doModInit(rsRetVal (*modInit)(int, int*, rsRetVal(**)(), rsRetVal(*)(), modInfo_
pNew->pszName = (uchar*) strdup((char*)name); /* we do not care if strdup() fails, we can accept that */
pNew->pModHdlr = pModHdlr;
/* TODO: take this from module */
- if(pModHdlr == NULL)
+ if(pModHdlr == NULL) {
pNew->eLinkType = eMOD_LINK_STATIC;
- else
+ } else {
pNew->eLinkType = eMOD_LINK_DYNAMIC_LOADED;
+ /* if we need to keep the linked module, save it */
+ if (pNew->eKeepType == eMOD_KEEP) {
+ if((pHandle = calloc(1, sizeof (*pHandle))) == NULL) {
+ iRet = RS_RET_OUT_OF_MEMORY;
+ goto finalize_it;
+ }
+
+ strncpy((char *)pHandle->szName,
+ (char *)name, PATH_MAX - 1);
+ pHandle->szName[PATH_MAX - 1] = '\0';
+ pHandle->pModHdlr = pModHdlr;
+ pHandle->next = pHandles;
+
+ pHandles = pHandle;
+ }
+ }
+
/* we initialized the structure, now let's add it to the linked list of modules */
addModToList(pNew);
@@ -740,6 +766,7 @@ Load(uchar *pModName)
modInfo_t *pModInfo;
uchar *pModDirCurr, *pModDirNext;
int iLoadCnt;
+ struct dlhandle_s *pHandle = NULL;
assert(pModName != NULL);
dbgprintf("Requested to load module '%s'\n", pModName);
@@ -829,7 +856,20 @@ Load(uchar *pModName)
/* complete load path constructed, so ... GO! */
dbgprintf("loading module '%s'\n", szPath);
- pModHdlr = dlopen((char *) szPath, RTLD_NOW);
+
+ /* see if we have this one already */
+ for (pHandle = pHandles; pHandle; pHandle = pHandle->next) {
+ if (!strcmp((char *)pModName, (char *)pHandle->szName)) {
+ pModHdlr = pHandle->pModHdlr;
+ break;
+ }
+ }
+
+ /* not found, try to dynamically link it */
+ if (!pModHdlr) {
+ pModHdlr = dlopen((char *) szPath, RTLD_NOW);
+ }
+
iLoadCnt++;
} while(pModHdlr == NULL && *pModName != '/' && pModDirNext);
diff --git a/runtime/modules.h b/runtime/modules.h
index df1afbc..7eff858 100644
--- a/runtime/modules.h
+++ b/runtime/modules.h
@@ -75,12 +75,26 @@ typedef enum eModLinkType_ {
eMOD_LINK_ALL /* special: all linkage types, e.g. for unload */
} eModLinkType_t;
+/* remember which shared libs we dlopen()-ed */
+struct dlhandle_s {
+ uchar szName[PATH_MAX];
+ void *pModHdlr;
+ struct dlhandle_s *next;
+};
+
+/* should this module be kept linked? */
+typedef enum eModKeepType_ {
+ eMOD_NOKEEP,
+ eMOD_KEEP
+} eModKeepType_t;
+
struct modInfo_s {
struct modInfo_s *pPrev; /* support for creating a double linked module list */
struct modInfo_s *pNext; /* support for creating a linked module list */
int iIFVers; /* Interface version of module */
eModType_t eType; /* type of this module */
eModLinkType_t eLinkType;
+ eModKeepType_t eKeepType; /* keep the module dynamically linked on unload */
uchar* pszName; /* printable module name, e.g. for dbgprintf */
unsigned uRefCnt; /* reference count for this module; 0 -> may be unloaded */
/* functions supported by all types of modules */
diff --git a/runtime/net.c b/runtime/net.c
index 7653ea1..789790f 100644
--- a/runtime/net.c
+++ b/runtime/net.c
@@ -69,6 +69,7 @@
#endif
MODULE_TYPE_LIB
+MODULE_TYPE_NOKEEP
/* static data */
DEFobjStaticHelpers
diff --git a/runtime/netstrms.c b/runtime/netstrms.c
index e9ff256..ea2dd9f 100644
--- a/runtime/netstrms.c
+++ b/runtime/netstrms.c
@@ -40,6 +40,7 @@
#include "netstrms.h"
MODULE_TYPE_LIB
+MODULE_TYPE_NOKEEP
/* static data */
DEFobjStaticHelpers
diff --git a/runtime/nsd_gtls.c b/runtime/nsd_gtls.c
index 0ee70e5..152dc8d 100644
--- a/runtime/nsd_gtls.c
+++ b/runtime/nsd_gtls.c
@@ -56,6 +56,7 @@
GCRY_THREAD_OPTION_PTHREAD_IMPL;
MODULE_TYPE_LIB
+MODULE_TYPE_KEEP
/* static data */
DEFobjStaticHelpers
diff --git a/runtime/nsd_ptcp.c b/runtime/nsd_ptcp.c
index ca00749..c891523 100644
--- a/runtime/nsd_ptcp.c
+++ b/runtime/nsd_ptcp.c
@@ -52,6 +52,7 @@
#include "nsd_ptcp.h"
MODULE_TYPE_LIB
+MODULE_TYPE_NOKEEP
/* static data */
DEFobjStaticHelpers
diff --git a/runtime/regexp.c b/runtime/regexp.c
index 86b3e6c..21079f8 100644
--- a/runtime/regexp.c
+++ b/runtime/regexp.c
@@ -35,6 +35,7 @@
#include "regexp.h"
MODULE_TYPE_LIB
+MODULE_TYPE_NOKEEP
/* static data */
DEFobjStaticHelpers
diff --git a/runtime/strmsrv.c b/runtime/strmsrv.c
index a122ca8..e66ad71 100644
--- a/runtime/strmsrv.c
+++ b/runtime/strmsrv.c
@@ -75,6 +75,7 @@
#include "unicode-helper.h"
MODULE_TYPE_LIB
+MODULE_TYPE_NOKEEP
/* defines */
#define STRMSESS_MAX_DEFAULT 200 /* default for nbr of strm sessions if no number is given */
diff --git a/runtime/zlibw.c b/runtime/zlibw.c
index 2b38621..455c20d 100644
--- a/runtime/zlibw.c
+++ b/runtime/zlibw.c
@@ -34,6 +34,7 @@
#include "zlibw.h"
MODULE_TYPE_LIB
+MODULE_TYPE_NOKEEP
/* static data */
DEFobjStaticHelpers
diff --git a/tcpclt.c b/tcpclt.c
index d7e30e2..0db98ea 100644
--- a/tcpclt.c
+++ b/tcpclt.c
@@ -46,6 +46,7 @@
#include "srUtils.h"
MODULE_TYPE_LIB
+MODULE_TYPE_NOKEEP
/* static data */
DEFobjStaticHelpers
diff --git a/tcpsrv.c b/tcpsrv.c
index fbb9446..e8d7914 100644
--- a/tcpsrv.c
+++ b/tcpsrv.c
@@ -71,6 +71,7 @@
#include "unicode-helper.h"
MODULE_TYPE_LIB
+MODULE_TYPE_NOKEEP
/* defines */
#define TCPSESS_MAX_DEFAULT 200 /* default for nbr of tcp sessions if no number is given */
diff --git a/tests/rt-init.c b/tests/rt-init.c
index dbe94b4..2d43943 100644
--- a/tests/rt-init.c
+++ b/tests/rt-init.c
@@ -28,7 +28,6 @@
MODULE_TYPE_TESTBENCH
-
BEGINInit
CODESTARTInit
ENDInit
diff --git a/tools/omdiscard.c b/tools/omdiscard.c
index 227ad8e..dbd1809 100644
--- a/tools/omdiscard.c
+++ b/tools/omdiscard.c
@@ -38,6 +38,7 @@
#include "module-template.h"
MODULE_TYPE_OUTPUT
+MODULE_TYPE_NOKEEP
/* internal structures
*/
diff --git a/tools/omfile.c b/tools/omfile.c
index 8c507a5..08f965b 100644
--- a/tools/omfile.c
+++ b/tools/omfile.c
@@ -70,6 +70,7 @@
#include "atomic.h"
MODULE_TYPE_OUTPUT
+MODULE_TYPE_NOKEEP
/* internal structures
*/
diff --git a/tools/omfwd.c b/tools/omfwd.c
index 487bb35..38a4a16 100644
--- a/tools/omfwd.c
+++ b/tools/omfwd.c
@@ -64,6 +64,7 @@
#include "errmsg.h"
MODULE_TYPE_OUTPUT
+MODULE_TYPE_NOKEEP
/* internal structures
*/
diff --git a/tools/ompipe.c b/tools/ompipe.c
index c51a5c4..58725fb 100644
--- a/tools/ompipe.c
+++ b/tools/ompipe.c
@@ -57,6 +57,7 @@
#include "errmsg.h"
MODULE_TYPE_OUTPUT
+MODULE_TYPE_NOKEEP
/* internal structures
*/
diff --git a/tools/omshell.c b/tools/omshell.c
index f8a6852..25f9838 100644
--- a/tools/omshell.c
+++ b/tools/omshell.c
@@ -46,6 +46,7 @@
#include "errmsg.h"
MODULE_TYPE_OUTPUT
+MODULE_TYPE_NOKEEP
/* internal structures
*/
diff --git a/tools/omusrmsg.c b/tools/omusrmsg.c
index 768baca..2d99c1e 100644
--- a/tools/omusrmsg.c
+++ b/tools/omusrmsg.c
@@ -87,6 +87,7 @@
MODULE_TYPE_OUTPUT
+MODULE_TYPE_NOKEEP
/* internal structures
*/
diff --git a/tools/pmrfc3164.c b/tools/pmrfc3164.c
index 38f556a..635ca98 100644
--- a/tools/pmrfc3164.c
+++ b/tools/pmrfc3164.c
@@ -45,6 +45,7 @@
#include "unicode-helper.h"
MODULE_TYPE_PARSER
+MODULE_TYPE_NOKEEP
PARSER_NAME("rsyslog.rfc3164")
/* internal structures
diff --git a/tools/pmrfc5424.c b/tools/pmrfc5424.c
index 07994ad..2bd1804 100644
--- a/tools/pmrfc5424.c
+++ b/tools/pmrfc5424.c
@@ -44,6 +44,7 @@
#include "unicode-helper.h"
MODULE_TYPE_PARSER
+MODULE_TYPE_NOKEEP
PARSER_NAME("rsyslog.rfc5424")
/* internal structures
diff --git a/tools/smfile.c b/tools/smfile.c
index 5e4a775..1e0bf09 100644
--- a/tools/smfile.c
+++ b/tools/smfile.c
@@ -46,6 +46,7 @@
#include "unicode-helper.h"
MODULE_TYPE_STRGEN
+MODULE_TYPE_NOKEEP
STRGEN_NAME("RSYSLOG_FileFormat")
/* internal structures
diff --git a/tools/smfwd.c b/tools/smfwd.c
index fe33fb2..60fe94a 100644
--- a/tools/smfwd.c
+++ b/tools/smfwd.c
@@ -43,6 +43,7 @@
#include "unicode-helper.h"
MODULE_TYPE_STRGEN
+MODULE_TYPE_NOKEEP
STRGEN_NAME("RSYSLOG_ForwardFormat")
/* internal structures
diff --git a/tools/smtradfile.c b/tools/smtradfile.c
index eff2f99..5484f7b 100644
--- a/tools/smtradfile.c
+++ b/tools/smtradfile.c
@@ -43,6 +43,7 @@
#include "unicode-helper.h"
MODULE_TYPE_STRGEN
+MODULE_TYPE_NOKEEP
STRGEN_NAME("RSYSLOG_TraditionalFileFormat")
/* internal structures
diff --git a/tools/smtradfwd.c b/tools/smtradfwd.c
index 88dc608..3771743 100644
--- a/tools/smtradfwd.c
+++ b/tools/smtradfwd.c
@@ -43,6 +43,7 @@
#include "unicode-helper.h"
MODULE_TYPE_STRGEN
+MODULE_TYPE_NOKEEP
STRGEN_NAME("RSYSLOG_TraditionalForwardFormat")
/* internal structures