diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2007-07-31 15:23:28 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2007-07-31 15:23:28 +0000 |
commit | 074ece90c0b7f32307716eeb6d0308b83197b6ce (patch) | |
tree | 707340dde192c4c4ac8b196f6da2d26bbfc22247 /omfile.c | |
parent | 7449e8356b19900acaa33e387bd4ea65ba85e204 (diff) | |
download | rsyslog-074ece90c0b7f32307716eeb6d0308b83197b6ce.tar.gz rsyslog-074ece90c0b7f32307716eeb6d0308b83197b6ce.tar.xz rsyslog-074ece90c0b7f32307716eeb6d0308b83197b6ce.zip |
- got the basic code in place to create an in-memory list of cfsysline
handlers (omfile.c used as testing case) -- not yet in active code
Diffstat (limited to 'omfile.c')
-rw-r--r-- | omfile.c | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -49,6 +49,7 @@ #include "template.h" #include "outchannel.h" #include "omfile.h" +#include "cfsysline.h" #include "module-template.h" /* internal structures @@ -119,6 +120,37 @@ CODESTARTdbgPrintInstInfo ENDdbgPrintInstInfo +/* set the dynaFile cache size. Does some limit checking. + * rgerhards, 2007-07-31 + */ +rsRetVal setDynaFileCacheSize(void __attribute__((unused)) *pVal, int iNewVal) +{ + DEFiRet; + uchar errMsg[128]; /* for dynamic error messages */ + + if(iNewVal < 1) { + snprintf((char*) errMsg, sizeof(errMsg)/sizeof(uchar), + "DynaFileCacheSize must be greater 0 (%d given), changed to 1.", iNewVal); + errno = 0; + logerror((char*) errMsg); + iRet = RS_RET_VAL_OUT_OF_RANGE; + iNewVal = 1; + } else if(iNewVal > 10000) { + snprintf((char*) errMsg, sizeof(errMsg)/sizeof(uchar), + "DynaFileCacheSize maximum is 10,000 (%d given), changed to 10,000.", iNewVal); + errno = 0; + logerror((char*) errMsg); + iRet = RS_RET_VAL_OUT_OF_RANGE; + iNewVal = 10000; + } + + iDynaFileCacheSize = iNewVal; + dprintf("DynaFileCacheSize changed to %d.\n", iNewVal); + + return iRet; +} + + /* Helper to cfline(). Parses a output channel name up until the first * comma and then looks for the template specifier. Tries * to find that template. Maps the output channel to the @@ -716,6 +748,11 @@ BEGINmodInit(File) CODESTARTmodInit *ipIFVersProvided = 1; /* so far, we only support the initial definition */ CODEmodInit_QueryRegCFSLineHdlr + CHKiRet(omsdRegCFSLineHdlr((uchar *)"dynafilecachesize", eCmdHdlrInt, (void*) setDynaFileCacheSize, NULL)); + CHKiRet(omsdRegCFSLineHdlr((uchar *)"dirowner", eCmdHdlrUID, NULL, &dirUID)); + CHKiRet(omsdRegCFSLineHdlr((uchar *)"dirgroup", eCmdHdlrGID, NULL, &dirGID)); + CHKiRet(omsdRegCFSLineHdlr((uchar *)"fileowner", eCmdHdlrUID, NULL, &fileUID)); + CHKiRet(omsdRegCFSLineHdlr((uchar *)"filegroup", eCmdHdlrGID, NULL, &fileGID)); ENDmodInit /* |