diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2013-10-28 09:00:26 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2013-10-28 09:00:26 +0100 |
commit | 33784d03f11a7d6f8c64e231c27b9656fac616e5 (patch) | |
tree | e24979f037a30458c2c0fbd99d985646dff590d4 | |
parent | 84537ced753ddcd0f86ac9b6f0887c611f8439d8 (diff) | |
download | rsyslog-33784d03f11a7d6f8c64e231c27b9656fac616e5.tar.gz rsyslog-33784d03f11a7d6f8c64e231c27b9656fac616e5.tar.bz2 rsyslog-33784d03f11a7d6f8c64e231c27b9656fac616e5.zip |
milestone: stage work for omfile worker instance handling
-rw-r--r-- | runtime/module-template.h | 7 | ||||
-rw-r--r-- | tools/omfile.c | 37 |
2 files changed, 36 insertions, 8 deletions
diff --git a/runtime/module-template.h b/runtime/module-template.h index a292711e..b9d1844d 100644 --- a/runtime/module-template.h +++ b/runtime/module-template.h @@ -178,17 +178,18 @@ static rsRetVal freeInstance(void* pModData)\ /* createWrkrInstance() */ #define BEGINcreateWrkrInstance \ -static rsRetVal createInstance(wrkrInstanceData_t **ppWrkrData)\ +static rsRetVal createWrkrInstance(wrkrInstanceData_t **ppWrkrData, instanceData *pData)\ {\ DEFiRet; /* store error code here */\ - instanceData *pWrkrData; /* use this to point to data elements */ + wrkrInstanceData_t *pWrkrData; /* use this to point to data elements */ #define CODESTARTcreateWrkrInstance \ if((pWrkrData = calloc(1, sizeof(wrkrInstanceData_t))) == NULL) {\ *ppWrkrData = NULL;\ ENDfunc \ return RS_RET_OUT_OF_MEMORY;\ - } + } \ + pWrkrData->pData = pData; #define ENDcreateWrkrInstance \ *ppWrkrData = pWrkrData;\ diff --git a/tools/omfile.c b/tools/omfile.c index 01d9cc5b..2100bfa7 100644 --- a/tools/omfile.c +++ b/tools/omfile.c @@ -181,8 +181,16 @@ typedef struct _instanceData { STATSCOUNTER_DEF(ctrMax, mutCtrMax); } instanceData; +/* to build a linked list for temporary storage of lines while we cannot commit */ +typedef struct linebuf { + uchar *filename; /* for dynafiles, make go away */ + uchar *ln; + struct linebuf *next; +} linebuf_t; + typedef struct wrkrInstanceData { instanceData *pData; + linebuf_t *pRoot; } wrkrInstanceData_t; @@ -895,6 +903,12 @@ CODESTARTcreateInstance ENDcreateInstance +BEGINcreateWrkrInstance +CODESTARTcreateWrkrInstance +ENDcreateWrkrInstance + + + BEGINfreeInstance CODESTARTfreeInstance free(pData->tplName); @@ -945,8 +959,10 @@ finalize_it: ENDendTransaction -BEGINdoAction -CODESTARTdoAction +#if 0 +static rsRetVal +doRealAction() +{ DBGPRINTF("file to log to: %s\n", (pData->bDynamicName) ? ppString[1] : pData->f_fname); DBGPRINTF("omfile: start of data: '%.128s'\n", ppString[0]); @@ -955,9 +971,20 @@ CODESTARTdoAction if(!bCoreSupportsBatching && pData->bFlushOnTXEnd) { CHKiRet(strm.Flush(pData->pStrm)); } -finalize_it: - if(iRet == RS_RET_OK) - iRet = RS_RET_DEFER_COMMIT; +} +#endif + +static rsRetVal +bufferLine(wrkrInstanceData_t *pWrkrData, uchar *filename, uchar *line) +{ + DEFiRet; + RETiRet; +} + +BEGINdoAction +CODESTARTdoAction + iRet = bufferLine(pWrkrData, (pData->bDynamicName) ? ppString[1] : pData->f_fname, + ppString[0]); ENDdoAction |