summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-04-27 17:57:47 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2011-04-27 17:57:47 +0200
commit6093f3110306e0575d10d09807da1e6895af4eba (patch)
treeec25293b4cb9c4c88799538609c15fae726f73cc
parentee346d8aec05bc79600f7d5280d88ab45d2bcab5 (diff)
downloadrsyslog-6093f3110306e0575d10d09807da1e6895af4eba.tar.gz
rsyslog-6093f3110306e0575d10d09807da1e6895af4eba.tar.xz
rsyslog-6093f3110306e0575d10d09807da1e6895af4eba.zip
step: moved main message queue activation to after priv drop
-rw-r--r--action.c1
-rw-r--r--dirty.h1
-rw-r--r--runtime/rsconf.c21
-rw-r--r--tools/syslogd.c13
4 files changed, 23 insertions, 13 deletions
diff --git a/action.c b/action.c
index 0ec64236..baf21804 100644
--- a/action.c
+++ b/action.c
@@ -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");
diff --git a/dirty.h b/dirty.h
index f27c5780..a831dd06 100644
--- a/dirty.h
+++ b/dirty.h
@@ -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;