summaryrefslogtreecommitdiffstats
path: root/syslogd.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-01-03 10:42:46 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-01-03 10:42:46 +0000
commit48cb0a980f657fe1d6484a1322db26c753835f03 (patch)
treeac9c969f85b51d1f7dbef1765ec641090e3e17d5 /syslogd.c
parent29d9729292d44d2827054a1aef27278f3dadd57e (diff)
downloadrsyslog-48cb0a980f657fe1d6484a1322db26c753835f03.tar.gz
rsyslog-48cb0a980f657fe1d6484a1322db26c753835f03.tar.xz
rsyslog-48cb0a980f657fe1d6484a1322db26c753835f03.zip
restructured queue interface to use rsRetVal and instances, removed
dependency on globals - now more like a real class
Diffstat (limited to 'syslogd.c')
-rw-r--r--syslogd.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/syslogd.c b/syslogd.c
index e1b0735a..e92ef1e0 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -447,6 +447,9 @@ static int Initialized = 0; /* set when we have initialized ourselves
extern int errno;
+queue_t *pMsgQueue = NULL; /* the main message queue */
+int iMainMsgQueueSize; /* size of the main message queue above */
+
/* This structure represents the files that will have log
* copies printed.
@@ -1930,7 +1933,7 @@ static void startWorker(void)
static void *
singleWorker()
{
- msgQueue *fifo = pMsgQueue;
+ queue_t *fifo = pMsgQueue;
msg_t *pMsg;
sigset_t sigSet;
@@ -1980,7 +1983,7 @@ singleWorker()
static void enqueueMsg(msg_t *pMsg)
{
int iRet;
- msgQueue *fifo = pMsgQueue;
+ queue_t *fifo = pMsgQueue;
struct timespec t;
assert(pMsg != NULL);
@@ -2767,7 +2770,7 @@ die(int sig)
freeSelectors();
/* Worker threads are stopped by freeSelectors() */
- queueDelete(pMsgQueue); /* delete fifo here! */
+ queueDestruct(pMsgQueue); /* delete fifo here! */
pMsgQueue = NULL;
/* rger 2005-02-22
@@ -3459,7 +3462,7 @@ init(void)
if(pMsgQueue != NULL) {
dbgprintf("deleting message queue\n");
- queueDelete(pMsgQueue); /* delete fifo here! */
+ queueDestruct(pMsgQueue); /* delete fifo here! */
pMsgQueue = NULL;
}
@@ -3507,10 +3510,9 @@ init(void)
}
/* create message queue */
- pMsgQueue = queueInit();
- if(pMsgQueue == NULL) {
- errno = 0; /* no queue is fatal, we need to give up in that case... */
- fprintf(stderr, "fatal error: could not create message queue - rsyslogd can not run!\n");
+ CHKiRet_Hdlr(queueConstruct(&pMsgQueue, QUEUETYPE_FIXED_ARRAY, iMainMsgQueueSize)) {
+ /* no queue is fatal, we need to give up in that case... */
+ fprintf(stderr, "fatal error %d: could not create message queue - rsyslogd can not run!\n", iRet);
exit(1);
}