diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2011-04-27 17:57:47 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2011-04-27 17:57:47 +0200 |
commit | 6093f3110306e0575d10d09807da1e6895af4eba (patch) | |
tree | ec25293b4cb9c4c88799538609c15fae726f73cc | |
parent | ee346d8aec05bc79600f7d5280d88ab45d2bcab5 (diff) | |
download | rsyslog-6093f3110306e0575d10d09807da1e6895af4eba.tar.gz rsyslog-6093f3110306e0575d10d09807da1e6895af4eba.tar.bz2 rsyslog-6093f3110306e0575d10d09807da1e6895af4eba.zip |
step: moved main message queue activation to after priv drop
-rw-r--r-- | action.c | 1 | ||||
-rw-r--r-- | dirty.h | 1 | ||||
-rw-r--r-- | runtime/rsconf.c | 21 | ||||
-rw-r--r-- | tools/syslogd.c | 13 |
4 files changed, 23 insertions, 13 deletions
@@ -1681,7 +1681,6 @@ addAction(action_t **ppAction, modInfo_t *pMod, void *pModData, omodStringReques pAction->pModData = pModData; /* now check if the module is compatible with select features */ if(pMod->isCompatibleWithFeature(sFEATURERepeatedMsgReduction) == RS_RET_OK) { -dbgprintf("XXXX: loadConf is %p in action.c\n", loadConf); pAction->f_ReduceRepeated = loadConf->globals.bReduceRepeatMsgs; } else { DBGPRINTF("module is incompatible with RepeatedMsgReduction - turned off\n"); @@ -43,6 +43,7 @@ extern int MarkInterval; extern int repeatinterval[2]; extern qqueue_t *pMsgQueue; /* the main message queue */ extern int iConfigVerify; /* is this just a config verify run? */ +extern int bHaveMainQueue; #define MAXREPEAT ((int)((sizeof(repeatinterval) / sizeof(repeatinterval[0])) - 1)) #define REPEATTIME(f) ((f)->f_time + repeatinterval[(f)->f_repeatcount]) #define BACKOFF(f) { if (++(f)->f_repeatcount > MAXREPEAT) \ diff --git a/runtime/rsconf.c b/runtime/rsconf.c index 2e2eaab6..45822f19 100644 --- a/runtime/rsconf.c +++ b/runtime/rsconf.c @@ -342,6 +342,26 @@ startInputModules(void) return RS_RET_OK; /* intentional: we do not care about module errors */ } + +/* activate the main queue */ +static inline rsRetVal +activateMainQueue() +{ + DEFiRet; + /* create message queue */ + CHKiRet_Hdlr(createMainQueue(&pMsgQueue, UCHAR_CONSTANT("main Q"))) { + /* 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); + FINALIZE; + } + + bHaveMainQueue = (ourConf->globals.mainQ.MainMsgQueType == QUEUETYPE_DIRECT) ? 0 : 1; + DBGPRINTF("Main processing queue is initialized and running\n"); +finalize_it: + RETiRet; +} + + /* Activate an already-loaded configuration. The configuration will become * the new running conf (if successful). Note that in theory this method may * be called when there already is a running conf. In practice, the current @@ -374,6 +394,7 @@ activate(rsconf_t *cnf) CHKiRet(dropPrivileges(cnf)); + CHKiRet(activateMainQueue()); /* finally let the inputs run... */ runInputModules(); diff --git a/tools/syslogd.c b/tools/syslogd.c index dcce4d77..4fe6fa26 100644 --- a/tools/syslogd.c +++ b/tools/syslogd.c @@ -231,7 +231,7 @@ int iCompatibilityMode = 0; /* version we should be compatible with; 0 means sy int MarkInterval = 20 * 60; /* interval between marks in seconds - read-only after startup */ int send_to_all = 0; /* send message to all IPv4/IPv6 addresses */ static int NoFork = 0; /* don't fork - don't run in daemon mode - read-only after startup */ -static int bHaveMainQueue = 0;/* set to 1 if the main queue - in queueing mode - is available +int bHaveMainQueue = 0;/* set to 1 if the main queue - in queueing mode - is available * If the main queue is either not yet ready or not running in * queueing mode (mode DIRECT!), then this is set to 0. */ @@ -1308,17 +1308,6 @@ init(void) legacyOptsHook(); - - /* create message queue */ - CHKiRet_Hdlr(createMainQueue(&pMsgQueue, UCHAR_CONSTANT("main Q"))) { - /* 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); - } - - bHaveMainQueue = (ourConf->globals.mainQ.MainMsgQueType == QUEUETYPE_DIRECT) ? 0 : 1; - DBGPRINTF("Main processing queue is initialized and running\n"); - memset(&sigAct, 0, sizeof (sigAct)); sigemptyset(&sigAct.sa_mask); sigAct.sa_handler = sighup_handler; |