diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-01-09 08:25:25 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-01-09 08:25:25 +0000 |
commit | fbd4ecdce40d1164c7cbdd55c672a83755e95482 (patch) | |
tree | d2e75ea5c1db839157e0e216685640a2e15451f7 /queue.c | |
parent | 0964658cc8a276bbdfce335d08898ee4097e87dc (diff) | |
download | rsyslog-fbd4ecdce40d1164c7cbdd55c672a83755e95482.tar.gz rsyslog-fbd4ecdce40d1164c7cbdd55c672a83755e95482.tar.bz2 rsyslog-fbd4ecdce40d1164c7cbdd55c672a83755e95482.zip |
- implemented new GetSize() handler for config files
- implemented $MainMsgQueueMaxFileSize configuration directive
Diffstat (limited to 'queue.c')
-rw-r--r-- | queue.c | 32 |
1 files changed, 29 insertions, 3 deletions
@@ -380,7 +380,7 @@ static rsRetVal qConstructDisk(queue_t *pThis) ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY); pThis->tVars.disk.lenSpoolDir = strlen((char*)pThis->tVars.disk.pszSpoolDir); - pThis->tVars.disk.iMaxFileSize = 10240000; //1024 * 3; // TODO: configurable! + pThis->tVars.disk.iMaxFileSize = 1024 * 1024; /* default is 1 MiB */ pThis->tVars.disk.fWrite.iCurrFileNum = 1; pThis->tVars.disk.fWrite.iCurrOffs = 0; @@ -712,6 +712,11 @@ rsRetVal queueStart(queue_t *pThis) int iState; int i; + assert(pThis != NULL); + + dbgprintf("Queue 0x%lx: type %d, maxFileSz %ld starting\n", (unsigned long) pThis, pThis->qType, + pThis->tVars.disk.iMaxFileSize); + if(pThis->qType != QUEUETYPE_DIRECT) { if((pThis->pWorkerThreads = calloc(pThis->iNumWorkerThreads, sizeof(pthread_t))) == NULL) ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY); @@ -720,8 +725,8 @@ rsRetVal queueStart(queue_t *pThis) pThis->bDoRun = 1; /* we are NOT done (else worker would immediately terminate) */ for(i = 0 ; i < pThis->iNumWorkerThreads ; ++i) { iState = pthread_create(&(pThis->pWorkerThreads[i]), NULL, queueWorker, (void*) pThis); - dbgprintf("Worker thread %d for queue 0x%lx, type %d started with state %d.\n", - i, (unsigned long) pThis, (int) pThis->qType, iState); + dbgprintf("Queue 0x%lx: Worker thread %x, index %d started with state %d.\n", + (unsigned long) pThis, (unsigned) pThis->pWorkerThreads[i], i, iState); } } @@ -770,6 +775,27 @@ rsRetVal queueDestruct(queue_t *pThis) } +/* set the queue's maximum file size + * rgerhards, 2008-01-09 + */ +rsRetVal +queueSetMaxFileSize(queue_t *pThis, size_t iMaxFileSize) +{ + DEFiRet; + + assert(pThis != 0); + + if(iMaxFileSize < 1024) { + ABORT_FINALIZE(RS_RET_VALUE_TOO_LOW); + } + + pThis->tVars.disk.iMaxFileSize = iMaxFileSize; + +finalize_it: + return iRet; +} + + /* enqueue a new user data element * Enqueues the new element and awakes worker thread. * TODO: this code still uses the "discard if queue full" approach from |