summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2010-04-26 12:08:00 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2010-04-26 12:08:00 +0200
commitd19806431653e6575a002ab48206c16d3041e465 (patch)
tree98c6b87a523f937acc0b0b4b1361a8e7b05daa9c
parentbbde403b46bd94cb8900562d8cfd3e0540913730 (diff)
downloadrsyslog-d19806431653e6575a002ab48206c16d3041e465.tar.gz
rsyslog-d19806431653e6575a002ab48206c16d3041e465.tar.xz
rsyslog-d19806431653e6575a002ab48206c16d3041e465.zip
added new $Sleep directive to hold processing for a couple of seconds during startup
-rw-r--r--ChangeLog2
-rw-r--r--doc/rsyslog_conf_global.html5
-rw-r--r--tools/syslogd.c20
3 files changed, 26 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 447f22fb..80779457 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
---------------------------------------------------------------------------
Version 4.7.2 [v4-devel] (rgerhards), 2010-04-??
+- added new $Sleep directive to hold processing for a couple of seconds
+ during startup
---------------------------------------------------------------------------
Version 4.7.1 [v4-devel] (rgerhards), 2010-04-22
- Solaris support much improved -- was not truely usable in 4.7.0
diff --git a/doc/rsyslog_conf_global.html b/doc/rsyslog_conf_global.html
index 8137bcba..8c1cc9a7 100644
--- a/doc/rsyslog_conf_global.html
+++ b/doc/rsyslog_conf_global.html
@@ -273,6 +273,9 @@ the value, the less precise the timestamp.
<li><a href="droppriv.html">$PrivDropToGroupID</a></li>
<li><a href="droppriv.html">$PrivDropToUser</a></li>
<li><a href="droppriv.html">$PrivDropToUserID</a></li>
+<li><b>$Sleep</b> &lt;seconds&gt; - puts the rsyslog main thread to sleep for the specified
+number of seconds immediately when the directive is encountered. You should have a
+good reason for using this directive!</li>
<li><a href="rsconf1_umask.html">$UMASK</a></li>
</ul>
<p><b>Where &lt;size_nbr&gt; is specified above,</b>
@@ -291,7 +294,7 @@ point of view, "1,,0.0.,.,0" also has the value 1000. </p>
[<a href="http://www.rsyslog.com/">rsyslog site</a>]</p>
<p><font size="2">This documentation is part of the
<a href="http://www.rsyslog.com/">rsyslog</a> project.<br>
-Copyright &copy; 2008, 2009 by <a href="http://www.gerhards.net/rainer">Rainer Gerhards</a> and
+Copyright &copy; 2008-2010 by <a href="http://www.gerhards.net/rainer">Rainer Gerhards</a> and
<a href="http://www.adiscon.com/">Adiscon</a>. Released under the GNU GPL
version 3 or higher.</font></p>
</body>
diff --git a/tools/syslogd.c b/tools/syslogd.c
index e318fd8e..98bfd3b2 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -2460,6 +2460,25 @@ finalize_it:
}
+
+/* Put the rsyslog main thread to sleep for n seconds. This was introduced as
+ * a quick and dirty workaround for a privilege drop race in regard to listener
+ * startup, which itself was a result of the not-yet-done proper coding of
+ * privilege drop code (quite some effort). It may be useful for other occasions, too.
+ * is specified).
+ * rgerhards, 2009-06-12
+ */
+static rsRetVal
+putToSleep(void __attribute__((unused)) *pVal, int iNewVal)
+{
+ DEFiRet;
+ DBGPRINTF("rsyslog main thread put to sleep via $sleep %d directive...\n", iNewVal);
+ srSleep(iNewVal, 0);
+ DBGPRINTF("rsyslog main thread continues after $sleep %d\n", iNewVal);
+ RETiRet;
+}
+
+
/* Switch to either an already existing rule set or start a new one. The
* named rule set becomes the new "current" rule set (what means that new
* actions are added to it).
@@ -2713,6 +2732,7 @@ static rsRetVal loadBuildInModules(void)
CHKiRet(regCfSysLineHdlr((uchar *)"actionresumeretrycount", 0, eCmdHdlrInt, NULL, &glbliActionResumeRetryCount, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"defaultruleset", 0, eCmdHdlrGetWord, setDefaultRuleset, NULL, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"ruleset", 0, eCmdHdlrGetWord, setCurrRuleset, NULL, NULL));
+ CHKiRet(regCfSysLineHdlr((uchar *)"sleep", 0, eCmdHdlrInt, putToSleep, NULL, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueuefilename", 0, eCmdHdlrGetWord, NULL, &pszMainMsgQFName, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueuesize", 0, eCmdHdlrInt, NULL, &iMainMsgQueueSize, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueuehighwatermark", 0, eCmdHdlrInt, NULL, &iMainMsgQHighWtrMark, NULL));