diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-01-24 17:55:09 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-01-24 17:55:09 +0000 |
commit | 5c686c8adcc473cbdbb14e4b2d736f9123210ee6 (patch) | |
tree | eb83fbca0d98ac4948b6d9ca22d8a0e4828815a9 /module-template.h | |
parent | 76782c240db52c81825c907c40c31ca8b48218de (diff) | |
download | rsyslog-5c686c8adcc473cbdbb14e4b2d736f9123210ee6.tar.gz rsyslog-5c686c8adcc473cbdbb14e4b2d736f9123210ee6.tar.xz rsyslog-5c686c8adcc473cbdbb14e4b2d736f9123210ee6.zip |
redesigned queue to utilize helper classes for threading support. This is
finally in a running state for regular (non disk-assisted) queues, with
a minor nit at shutdown. So I can finally commit the work again to
CVS...
Diffstat (limited to 'module-template.h')
-rw-r--r-- | module-template.h | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/module-template.h b/module-template.h index ecd6fe6d..c92ec25a 100644 --- a/module-template.h +++ b/module-template.h @@ -100,12 +100,13 @@ static rsRetVal createInstance(instanceData **ppData)\ #define CODESTARTcreateInstance \ if((pData = calloc(1, sizeof(instanceData))) == NULL) {\ *ppData = NULL;\ + ENDfunc \ return RS_RET_OUT_OF_MEMORY;\ } #define ENDcreateInstance \ *ppData = pData;\ - return iRet;\ + RETiRet;\ } /* freeInstance() @@ -129,7 +130,7 @@ static rsRetVal freeInstance(void* pModData)\ #define ENDfreeInstance \ if(pData != NULL)\ free(pData); /* we need to free this in any case */\ - return iRet;\ + RETiRet;\ } /* isCompatibleWithFeature() @@ -137,12 +138,13 @@ static rsRetVal freeInstance(void* pModData)\ #define BEGINisCompatibleWithFeature \ static rsRetVal isCompatibleWithFeature(syslogFeature __attribute__((unused)) eFeat)\ {\ - rsRetVal iRet = RS_RET_INCOMPATIBLE; + rsRetVal iRet = RS_RET_INCOMPATIBLE; \ + BEGINfunc #define CODESTARTisCompatibleWithFeature #define ENDisCompatibleWithFeature \ - return iRet;\ + RETiRet;\ } /* doAction() @@ -156,7 +158,7 @@ static rsRetVal doAction(uchar __attribute__((unused)) **ppString, unsigned __at /* ppString may be NULL if the output module requested no strings */ #define ENDdoAction \ - return iRet;\ + RETiRet;\ } @@ -174,7 +176,7 @@ static rsRetVal dbgPrintInstInfo(void *pModData)\ pData = (instanceData*) pModData; #define ENDdbgPrintInstInfo \ - return iRet;\ + RETiRet;\ } @@ -189,13 +191,14 @@ static rsRetVal dbgPrintInstInfo(void *pModData)\ static rsRetVal needUDPSocket(void *pModData)\ {\ rsRetVal iRet = RS_RET_FALSE;\ - instanceData *pData = NULL; + instanceData *pData = NULL; \ + BEGINfunc #define CODESTARTneedUDPSocket \ pData = (instanceData*) pModData; #define ENDneedUDPSocket \ - return iRet;\ + RETiRet;\ } @@ -245,7 +248,7 @@ finalize_it:\ } #define ENDparseSelectorAct \ - return iRet;\ + RETiRet;\ } @@ -267,7 +270,7 @@ static rsRetVal tryResume(instanceData __attribute__((unused)) *pData)\ assert(pData != NULL); #define ENDtryResume \ - return iRet;\ + RETiRet;\ } @@ -281,14 +284,16 @@ static rsRetVal queryEtryPt(uchar *name, rsRetVal (**pEtryPoint)())\ DEFiRet; #define CODESTARTqueryEtryPt \ - if((name == NULL) || (pEtryPoint == NULL))\ + if((name == NULL) || (pEtryPoint == NULL)) {\ + ENDfunc \ return RS_RET_PARAM_ERROR;\ + } \ *pEtryPoint = NULL; #define ENDqueryEtryPt \ if(iRet == RS_RET_OK)\ iRet = (*pEtryPoint == NULL) ? RS_RET_NOT_FOUND : RS_RET_OK;\ - return iRet;\ + RETiRet;\ } /* the following definition is the standard block for queryEtryPt for all types @@ -372,13 +377,15 @@ rsRetVal modInit##uniqName(int iIFVersRequested __attribute__((unused)), int *ip #define CODESTARTmodInit \ assert(pHostQueryEtryPt != NULL);\ - if((pQueryEtryPt == NULL) || (ipIFVersProvided == NULL))\ - return RS_RET_PARAM_ERROR; + if((pQueryEtryPt == NULL) || (ipIFVersProvided == NULL)) {\ + ENDfunc \ + return RS_RET_PARAM_ERROR; \ + } #define ENDmodInit \ finalize_it:\ *pQueryEtryPt = queryEtryPt;\ - return iRet;\ + RETiRet;\ } @@ -408,7 +415,7 @@ static rsRetVal modExit(void)\ #define CODESTARTmodExit #define ENDmodExit \ - return iRet;\ + RETiRet;\ } @@ -423,10 +430,11 @@ static rsRetVal runInput(thrdInfo_t __attribute__((unused)) *pThrd)\ {\ DEFiRet; -#define CODESTARTrunInput +#define CODESTARTrunInput \ + dbgSetThrdName((uchar*)__FILE__); /* we need to provide something better later */ #define ENDrunInput \ - return iRet;\ + RETiRet;\ } @@ -446,7 +454,7 @@ static rsRetVal willRun(void)\ #define CODESTARTwillRun #define ENDwillRun \ - return iRet;\ + RETiRet;\ } @@ -465,7 +473,7 @@ static rsRetVal afterRun(void)\ #define CODESTARTafterRun #define ENDafterRun \ - return iRet;\ + RETiRet;\ } |