summaryrefslogtreecommitdiffstats
path: root/runtime/modules.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-05-07 10:44:46 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-05-07 10:44:46 +0200
commit68877497a131d5b7c5b1588b771a623fc0ad41c1 (patch)
tree75f2267c053ff9bed596d6b46787045cf212f0ed /runtime/modules.c
parentbbb0d7c9d1b63dfd78f0ab33fd014909b20bf785 (diff)
downloadrsyslog-68877497a131d5b7c5b1588b771a623fc0ad41c1.tar.gz
rsyslog-68877497a131d5b7c5b1588b771a623fc0ad41c1.tar.xz
rsyslog-68877497a131d5b7c5b1588b771a623fc0ad41c1.zip
first shot at action state machine implemention (untested)
I am commiting it so that the code is visible, but will no begin with the test environment.
Diffstat (limited to 'runtime/modules.c')
-rw-r--r--runtime/modules.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/runtime/modules.c b/runtime/modules.c
index 024c1c9a..bfd87a71 100644
--- a/runtime/modules.c
+++ b/runtime/modules.c
@@ -68,6 +68,21 @@ static modInfo_t *pLoadedModulesLast = NULL; /* tail-pointer */
uchar *pModDir = NULL; /* read-only after startup */
+/* we provide a set of dummy functions for output modules that do not support the
+ * transactional interface. As they do not do this, they commit each message they
+ * receive, and as such the dummies can always return RS_RET_OK without causing
+ * harm. This simplifies things as in action processing we do not need to check
+ * if the transactional entry points exist.
+ */
+static rsRetVal dummyBeginTransaction()
+{
+ return RS_RET_OK;
+}
+static rsRetVal dummyEndTransaction()
+{
+ return RS_RET_OK;
+}
+
#ifdef DEBUG
/* we add some home-grown support to track our users (and detect who does not free us). In
* the long term, this should probably be migrated into debug.c (TODO). -- rgerhards, 2008-03-11
@@ -423,11 +438,17 @@ doModInit(rsRetVal (*modInit)(int, int*, rsRetVal(**)(), rsRetVal(*)(), modInfo_
localRet = (*pNew->modQueryEtryPt)((uchar*)"doHUP", &pNew->doHUP);
if(localRet != RS_RET_OK && localRet != RS_RET_MODULE_ENTRY_POINT_NOT_FOUND)
ABORT_FINALIZE(localRet);
+
localRet = (*pNew->modQueryEtryPt)((uchar*)"beginTransaction", &pNew->mod.om.beginTransaction);
- if(localRet != RS_RET_OK && localRet != RS_RET_MODULE_ENTRY_POINT_NOT_FOUND)
+ if(localRet == RS_RET_MODULE_ENTRY_POINT_NOT_FOUND)
+ pNew->mod.om.beginTransaction = dummyBeginTransaction;
+ else if(localRet != RS_RET_OK)
ABORT_FINALIZE(localRet);
+
localRet = (*pNew->modQueryEtryPt)((uchar*)"endTransaction", &pNew->mod.om.endTransaction);
- if(localRet != RS_RET_OK && localRet != RS_RET_MODULE_ENTRY_POINT_NOT_FOUND)
+ if(localRet == RS_RET_MODULE_ENTRY_POINT_NOT_FOUND)
+ pNew->mod.om.beginTransaction = dummyEndTransaction;
+ else if(localRet != RS_RET_OK)
ABORT_FINALIZE(localRet);
break;
case eMOD_LIB: