summaryrefslogtreecommitdiffstats
path: root/action.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-05-12 15:27:40 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-05-12 15:27:40 +0200
commitbb79e96dc300fa5a2182e7c047afb3b15c5dc870 (patch)
tree85680d43b503648da48fafe1178b1cb1ce62cc86 /action.c
parent21b7f7e603639fa8f354c954b0e467abb72b6c12 (diff)
downloadrsyslog-bb79e96dc300fa5a2182e7c047afb3b15c5dc870.tar.gz
rsyslog-bb79e96dc300fa5a2182e7c047afb3b15c5dc870.tar.xz
rsyslog-bb79e96dc300fa5a2182e7c047afb3b15c5dc870.zip
moving to a cleaner implementation of batches
... now that we know what we need from a theoretical POV.
Diffstat (limited to 'action.c')
-rw-r--r--action.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/action.c b/action.c
index 509ad749..b12eda6e 100644
--- a/action.c
+++ b/action.c
@@ -42,13 +42,14 @@
#include "cfsysline.h"
#include "srUtils.h"
#include "errmsg.h"
+#include "batch.h"
#include "wti.h"
#include "datetime.h"
#define NO_TIME_PROVIDED 0 /* indicate we do not provide any cached time */
/* forward definitions */
-rsRetVal actionCallDoActionMULTIQUEUE(action_t *pAction, aUsrp_t*);
+static rsRetVal actionCallDoActionMULTIQUEUE(action_t *pAction, batch_t *pBatch);
/* object static data (once for all instances) */
/* TODO: make this an object! DEFobjStaticHelpers -- rgerhards, 2008-03-05 */
@@ -261,7 +262,7 @@ actionConstructFinalize(action_t *pThis)
* spec. -- rgerhards, 2008-01-30
*/
CHKiRet(qqueueConstruct(&pThis->pQueue, ActionQueType, 1, iActionQueueSize,
- (rsRetVal (*)(void*,aUsrp_t*))actionCallDoActionMULTIQUEUE));
+ (rsRetVal (*)(void*, batch_t*))actionCallDoActionMULTIQUEUE));
obj.SetName((obj_t*) pThis->pQueue, pszQName);
/* ... set some properties ... */
@@ -782,19 +783,19 @@ finalize_it:
* for processing.
* rgerhards, 2009-04-22
*/
-rsRetVal
-actionCallDoActionMULTIQUEUEprocessing(action_t *pAction, aUsrp_t *paUsrp)
+static rsRetVal
+actionCallDoActionMULTIQUEUEprocessing(action_t *pAction, batch_t *pBatch)
{
int i;
msg_t *pMsg;
rsRetVal localRet;
DEFiRet;
- assert(paUsrp != NULL);
+ assert(pBatch != NULL);
- for(i = 0 ; i < paUsrp->nElem ; i++) {
- pMsg = (msg_t*) paUsrp->pUsrp[i];
-dbgprintf("actionCall..MULTIQUEUE: i: %d, pMsg: %p\n", i, pMsg);
+ for(i = 0 ; i < pBatch->nElem ; i++) {
+ pMsg = (msg_t*) pBatch->pElem[i].pUsrp;
+dbgprintf("actionCall..MULTIQUEUE: i: %d/%d, pMsg: %p\n", i, pBatch->nElem, pMsg);
localRet = actionProcessMessage(pAction, pMsg);
dbgprintf("action call returned %d\n", localRet);
msgDestruct(&pMsg); /* TODO: change: we are now finished with the message */
@@ -810,13 +811,13 @@ finalize_it:
* for processing.
* rgerhards, 2009-04-22
*/
-rsRetVal
-actionCallDoActionMULTIQUEUE(action_t *pAction, aUsrp_t *paUsrp)
+static rsRetVal
+actionCallDoActionMULTIQUEUE(action_t *pAction, batch_t *pBatch)
{
int iCancelStateSave;
DEFiRet;
- assert(paUsrp != NULL);
+ assert(pBatch != NULL);
/* We now must guard the output module against execution by multiple threads. The
* plugin interface specifies that output modules must not be thread-safe (except
@@ -828,7 +829,7 @@ actionCallDoActionMULTIQUEUE(action_t *pAction, aUsrp_t *paUsrp)
pthread_cleanup_push(mutexCancelCleanup, &pAction->mutActExec);
pthread_setcancelstate(iCancelStateSave, NULL);
- iRet = actionCallDoActionMULTIQUEUEprocessing(pAction, paUsrp);
+ iRet = actionCallDoActionMULTIQUEUEprocessing(pAction, pBatch);
pthread_cleanup_pop(1); /* unlock mutex */