From 46d0a95fc1680bdef960260fba98d06ba7336d0d Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 10 Jan 2008 13:23:53 +0000 Subject: changed some config parameters and some cleanup --- msg.c | 2 +- obj.c | 2 +- obj.h | 2 +- queue.c | 6 +++--- syslogd.c | 24 ++++++++++++------------ syslogd.h | 1 - 6 files changed, 18 insertions(+), 19 deletions(-) diff --git a/msg.c b/msg.c index f5ebf36a..00654c21 100644 --- a/msg.c +++ b/msg.c @@ -414,7 +414,7 @@ static rsRetVal MsgSerialize(msg_t *pThis, strm_t *pStrm) objSerializePTR(pStrm, pCSPROCID, CSTR); objSerializePTR(pStrm, pCSMSGID, CSTR); - CHKiRet(objEndSerialize(pStrm, (obj_t*) pThis)); + CHKiRet(objEndSerialize(pStrm)); finalize_it: return iRet; diff --git a/obj.c b/obj.c index c68f2c24..938e1ead 100644 --- a/obj.c +++ b/obj.c @@ -265,7 +265,7 @@ finalize_it: /* end serialization of an object. The caller receives a * standard C string, which he must free when no longer needed. */ -rsRetVal objEndSerialize(strm_t *pStrm, obj_t *pObj) +rsRetVal objEndSerialize(strm_t *pStrm) { DEFiRet; diff --git a/obj.h b/obj.h index c27e228c..e73e61f3 100644 --- a/obj.h +++ b/obj.h @@ -80,7 +80,7 @@ rsRetVal objInfoConstruct(objInfo_t **ppThis, objID_t objID, uchar *pszName, int rsRetVal objInfoSetMethod(objInfo_t *pThis, objMethod_t objMethod, rsRetVal (*pHandler)(void*)); rsRetVal objBeginSerialize(strm_t *pStrm, obj_t *pObj); rsRetVal objSerializeProp(strm_t *pStrm, uchar *pszPropName, propertyType_t propType, void *pUsr); -rsRetVal objEndSerialize(strm_t *pStrm, obj_t *pObj); +rsRetVal objEndSerialize(strm_t *pStrm); rsRetVal objRegisterObj(objID_t oID, objInfo_t *pInfo); rsRetVal objDeserialize(void *ppObj, objID_t objTypeExpected, strm_t *pSerStore); PROTOTYPEObjClassInit(obj); diff --git a/queue.c b/queue.c index a716c725..bfd456f4 100644 --- a/queue.c +++ b/queue.c @@ -203,14 +203,14 @@ static rsRetVal qConstructDisk(queue_t *pThis) assert(pThis != NULL); CHKiRet(strmConstruct(&pThis->tVars.disk.pWrite)); - CHKiRet(strmSetDir(pThis->tVars.disk.pWrite, pszSpoolDirectory, strlen((char*)pszSpoolDirectory))); + CHKiRet(strmSetDir(pThis->tVars.disk.pWrite, glblGetWorkDir(), strlen((char*)glblGetWorkDir()))); CHKiRet(strmSetiMaxFiles(pThis->tVars.disk.pWrite, 10000000)); CHKiRet(strmSettOperationsMode(pThis->tVars.disk.pWrite, STREAMMODE_WRITE)); CHKiRet(strmConstructFinalize(pThis->tVars.disk.pWrite)); CHKiRet(strmConstruct(&pThis->tVars.disk.pRead)); CHKiRet(strmSetbDeleteOnClose(pThis->tVars.disk.pRead, 1)); - CHKiRet(strmSetDir(pThis->tVars.disk.pRead, pszSpoolDirectory, strlen((char*)pszSpoolDirectory))); + CHKiRet(strmSetDir(pThis->tVars.disk.pRead, glblGetWorkDir(), strlen((char*)glblGetWorkDir()))); CHKiRet(strmSetiMaxFiles(pThis->tVars.disk.pRead, 10000000)); CHKiRet(strmSettOperationsMode(pThis->tVars.disk.pRead, STREAMMODE_READ)); CHKiRet(strmConstructFinalize(pThis->tVars.disk.pRead)); @@ -425,7 +425,7 @@ rsRetVal queueConstruct(queue_t **ppThis, queueType_t qType, int iWorkerThreads, } /* we have an object, so let's fill the properties */ - if((pThis->pszSpoolDir = (uchar*) strdup((char*)pszSpoolDirectory)) == NULL) + if((pThis->pszSpoolDir = (uchar*) strdup((char*)glblGetWorkDir())) == NULL) ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY); pThis->lenSpoolDir = strlen((char*)pThis->pszSpoolDir); diff --git a/syslogd.c b/syslogd.c index d624e678..d949b72b 100644 --- a/syslogd.c +++ b/syslogd.c @@ -380,8 +380,8 @@ static int logEveryMsg = 0;/* no repeat message processing - read-only after st * 0 - suppress duplicate messages * 1 - do NOT suppress duplicate messages */ -uchar *pszSpoolDirectory = NULL;/* name of rsyslog's spool directory (without trailing slash) */ -uchar *pszMainMsgQFilePrefix = NULL;/* prefix for the main message queue file */ +uchar *pszWorkDir = NULL;/* name of rsyslog's spool directory (without trailing slash) */ +uchar *pszMainMsgQFName = NULL;/* prefix for the main message queue file */ size_t iMainMsgQueMaxFileSize = 1024*1024; /* end global config file state variables */ @@ -512,13 +512,13 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a free(pModDir); pModDir = NULL; } - if(pszSpoolDirectory != NULL) { - free(pszSpoolDirectory); - pszSpoolDirectory = NULL; + if(pszWorkDir != NULL) { + free(pszWorkDir); + pszWorkDir = NULL; } - if(pszMainMsgQFilePrefix != NULL) { - free(pszMainMsgQFilePrefix); - pszMainMsgQFilePrefix = NULL; + if(pszMainMsgQFName != NULL) { + free(pszMainMsgQFName); + pszMainMsgQFName = NULL; } iMainMsgQueueSize = 10000; iMainMsgQueMaxFileSize = 1024 * 1024; @@ -3122,7 +3122,7 @@ static void dbgPrintInitInfo(void) dbgprintf("Main queue size %d messages.\n", iMainMsgQueueSize); dbgprintf("Main queue worker threads: %d\n", iMainMsgQueueNumWorkers); - dbgprintf("Spool Directory: '%s'.\n", pszSpoolDirectory); + dbgprintf("Spool Directory: '%s'.\n", pszWorkDir); } @@ -3372,7 +3372,7 @@ init(void) setQPROP(queueSetMaxFileSize, "$MainMsgQueueFileSize", iMainMsgQueMaxFileSize); setQPROPstr(queueSetFilePrefix, "$MainMsgQueueFilePrefix", - (pszMainMsgQFilePrefix == NULL ? (uchar*) "mainq" : pszMainMsgQFilePrefix)); + (pszMainMsgQFName == NULL ? (uchar*) "mainq" : pszMainMsgQFName)); # undef setQPROP # undef setQPROPstr @@ -4512,8 +4512,8 @@ static rsRetVal loadBuildInModules(void) * is that rsyslog will terminate if we can not register our built-in config commands. * This, I think, is the right thing to do. -- rgerhards, 2007-07-31 */ - CHKiRet(regCfSysLineHdlr((uchar *)"spooldirectory", 0, eCmdHdlrGetWord, NULL, &pszSpoolDirectory, NULL)); - CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueuefileprefix", 0, eCmdHdlrGetWord, NULL, &pszMainMsgQFilePrefix, NULL)); + CHKiRet(regCfSysLineHdlr((uchar *)"workdirectory", 0, eCmdHdlrGetWord, NULL, &pszWorkDir, NULL)); + CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueuefilename", 0, eCmdHdlrGetWord, NULL, &pszMainMsgQFName, NULL)); CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueuesize", 0, eCmdHdlrInt, NULL, &iMainMsgQueueSize, NULL)); CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueuetype", 0, eCmdHdlrGetWord, setMainMsgQueType, NULL, NULL)); CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueueworkerthreads", 0, eCmdHdlrInt, NULL, &iMainMsgQueueNumWorkers, NULL)); diff --git a/syslogd.h b/syslogd.h index 67f10daf..55a5a648 100644 --- a/syslogd.h +++ b/syslogd.h @@ -82,6 +82,5 @@ extern char **StripDomains; extern char *LocalDomain; extern int bDropMalPTRMsgs; extern char ctty[]; -extern uchar *pszSpoolDirectory; #endif /* #ifndef SYSLOGD_H_INCLUDED */ -- cgit