summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog53
-rw-r--r--action.c132
-rw-r--r--configure.ac52
-rw-r--r--doc/rsyslog_conf_filter.html4
-rw-r--r--doc/rsyslog_conf_global.html6
-rw-r--r--plugins/imklog/ksym.c4
-rw-r--r--plugins/imudp/imudp.c41
-rw-r--r--plugins/omoracle/omoracle.c19
-rw-r--r--plugins/omtesting/omtesting.c2
-rw-r--r--rsyslog.service.in1
-rw-r--r--runtime/atomic.h54
-rw-r--r--runtime/batch.h11
-rw-r--r--runtime/cfsysline.c7
-rw-r--r--runtime/conf.c7
-rw-r--r--runtime/ctok.c4
-rw-r--r--runtime/debug.c14
-rw-r--r--runtime/glbl.c26
-rw-r--r--runtime/msg.c4
-rw-r--r--runtime/parser.c2
-rw-r--r--runtime/queue.c2
-rw-r--r--runtime/statsobj.h8
-rw-r--r--template.c10
-rw-r--r--tests/cfg4.testin52
-rw-r--r--tests/testsuites/parse1.conf1
-rw-r--r--threads.c3
-rw-r--r--tools/omfile.c1
-rw-r--r--tools/omfwd.c2
-rw-r--r--tools/omusrmsg.c1
-rw-r--r--tools/rsyslog.conf.54
-rw-r--r--tools/syslogd.c19
30 files changed, 330 insertions, 216 deletions
diff --git a/ChangeLog b/ChangeLog
index fd7229f6..b607c485 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,12 @@
---------------------------------------------------------------------------
+Version 6.1.3 [DEVEL] (rgerhards), 2010-12-??
+- added $IMUDPSchedulingPolicy and $IMUDPSchedulingPriority config settings
+- added $LocalHostName config directive
+- bugfix: fixed build problems on some platforms
+ namely those that have 32bit atomic operations but not 64 bit ones
+- bugfix: local hostname was pulled too-early, so that some config
+ directives (namely FQDN settings) did not have any effect
+---------------------------------------------------------------------------
Version 6.1.2 [DEVEL] (rgerhards), 2010-12-16
- added experimental support for log normalizaton (via liblognorm)
support for normalizing log messages has been added in the form of
@@ -51,6 +59,14 @@ expected that interfaces, even new ones, break during the initial
syslog plain tcp input plugin (NOT supporting TLS!)
[ported from v4]
---------------------------------------------------------------------------
+Version 5.7.3 [V5-DEVEL] (rgerhards), 2010-12-??
+- added $IMUDPSchedulingPolicy and $IMUDPSchedulingPriority config settings
+- added $LocalHostName config directive
+- bugfix: fixed build problems on some platforms
+ namely those that have 32bit atomic operations but not 64 bit ones
+- bugfix: local hostname was pulled too-early, so that some config
+ directives (namely FQDN settings) did not have any effect
+---------------------------------------------------------------------------
Version 5.7.2 [V5-DEVEL] (rgerhards), 2010-11-26
- bugfix(important): problem in TLS handling could cause rsyslog to loop
in a tight loop, effectively disabling functionality and bearing the
@@ -96,7 +112,21 @@ Version 5.7.0 [V5-DEVEL] (rgerhards), 2010-09-16
thanks to Lennart Poettering for this patch
* sd-systemd API added as part of rsyslog runtime library
---------------------------------------------------------------------------
-Version 5.6.2 [V5-STABLE] (rgerhards), 2010-11-??
+Version 5.6.3 [V5-STABLE] (rgerhards), 2010-12-??
+- bugfix: action processor released mememory too early, resulting in
+ potential issue in retry cases (but very unlikely due to another
+ bug, which I also fixed -- only after the fix this problem here
+ became actually visible).
+- bugfix: batch processing flagged invalid message as "bad" under some
+ circumstances
+- bugfix: unitialized variable could cause issues under extreme conditions
+ plus some minor nits. This was found after a clang static code analyzer
+ analysis (great tool, and special thanks to Marcin for telling me about
+ it!)
+- bugfix: batches which had actions in error were not properly retried in
+ all cases
+---------------------------------------------------------------------------
+Version 5.6.2 [V5-STABLE] (rgerhards), 2010-11-30
- bugfix: compile failed on systems without epoll_create1()
Thanks to David Hill for providing a fix.
- bugfix: atomic increment for msg object may not work correct on all
@@ -612,7 +642,7 @@ increase.
- increased ompgsql performance by adapting to new transactional
output module interface
---------------------------------------------------------------------------
-Version 4.7.3 [v4-devel] (rgerhards), 2010-??-??
+Version 4.7.3 [v4-devel] (rgerhards), 2010-11-25
- added omuxsock, which permits to write message to local Unix sockets
this is the counterpart to imuxsock, enabling fast local forwarding
- added imptcp, a simplified, Linux-specific and potentielly fast
@@ -670,16 +700,22 @@ Version 4.7.0 [v4-devel] (rgerhards), 2010-04-14
Thanks for varmojfekoj for pointing me at this bug.
- imported changes from 4.5.6 and below
---------------------------------------------------------------------------
-Version 4.6.5 [v4-stable] (rgerhards), 2010-??-??
-- bugfix(important): problem in TLS handling could cause rsyslog to loop
- in a tight loop, effectively disabling functionality and bearing the
- risk of unresponsiveness of the whole system.
- Bug tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=194
+Version 4.6.6 [v4-stable] (rgerhards), 2010-11-??
- bugfix: a couple of problems that imfile had on some platforms, namely
Ubuntu (not their fault, but occured there)
- bugfix: imfile utilizes 32 bit to track offset. Most importantly,
this problem can not experienced on Fedora 64 bit OS (which has
64 bit long's!)
+- some improvements thanks to clang's static code analyzer
+ o overall cleanup (mostly unnecessary writes and otherwise unused stuff)
+ o bugfix: fixed a very remote problem in msg.c which could occur when
+ running under extremely low memory conditions
+---------------------------------------------------------------------------
+Version 4.6.5 [v4-stable] (rgerhards), 2010-11-24
+- bugfix(important): problem in TLS handling could cause rsyslog to loop
+ in a tight loop, effectively disabling functionality and bearing the
+ risk of unresponsiveness of the whole system.
+ Bug tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=194
---------------------------------------------------------------------------
Version 4.6.4 [v4-stable] (rgerhards), 2010-08-05
- bugfix: zero-sized (empty) messages were processed by imtcp
@@ -1307,6 +1343,9 @@ version before switching to this one.
- bugfix: memory leak in ompgsql
Thanks to Ken for providing the patch
---------------------------------------------------------------------------
+Version 3.22.4 [v3-stable] (rgerhards), 2010-??-??
+- improved some code based on clang static analyzer results
+---------------------------------------------------------------------------
Version 3.22.3 [v3-stable] (rgerhards), 2010-11-24
- bugfix(important): problem in TLS handling could cause rsyslog to loop
in a tight loop, effectively disabling functionality and bearing the
diff --git a/action.c b/action.c
index 999dc420..81195e8b 100644
--- a/action.c
+++ b/action.c
@@ -661,32 +661,34 @@ rsRetVal actionDbgPrint(action_t *pThis)
/* prepare the calling parameters for doAction()
* rgerhards, 2009-05-07
*/
-static rsRetVal prepareDoActionParams(action_t *pAction, msg_t *pMsg, uchar **ppMsgs, size_t *lenMsgs)
+static rsRetVal prepareDoActionParams(action_t *pAction, batch_obj_t *pElem)
{
int i;
+ msg_t *pMsg;
DEFiRet;
ASSERT(pAction != NULL);
+ ASSERT(pElem != NULL);
+ pMsg = (msg_t*) pElem->pUsrp;
/* here we must loop to process all requested strings */
for(i = 0 ; i < pAction->iNumTpls ; ++i) {
switch(pAction->eParamPassing) {
case ACT_STRING_PASSING:
- if(ppMsgs[i] == NULL)
- lenMsgs[i] = 0;
- CHKiRet(tplToString(pAction->ppTpl[i], pMsg, &(ppMsgs[i]), &lenMsgs[i]));
+ CHKiRet(tplToString(pAction->ppTpl[i], pMsg, &(pElem->staticActStrings[i]),
+ &pElem->staticLenStrings[i]));
+ pElem->staticActParams[i] = pElem->staticActStrings[i];
break;
case ACT_ARRAY_PASSING:
- CHKiRet(tplToArray(pAction->ppTpl[i], pMsg, (uchar***) &(ppMsgs[i])));
+ CHKiRet(tplToArray(pAction->ppTpl[i], pMsg, (uchar***) &(pElem->staticActParams[i])));
break;
case ACT_MSG_PASSING:
- /* we abuse the uchar* ptr, it now actually is a void*, but we can not
- * change that other than by chaning the interface, what we don't like...
- */
- ppMsgs[i] = (void*) pMsg;
- lenMsgs[i] = 0; /* init for *next* action */
+ pElem->staticActParams[i] = (void*) pMsg;
+ break;
+ default:dbgprintf("software bug/error: unknown pAction->eParamPassing %d in prepareDoActionParams\n",
+ (int) pAction->eParamPassing);
+ assert(0); /* software bug if this happens! */
break;
- default:assert(0); /* software bug if this happens! */
}
}
@@ -695,26 +697,56 @@ finalize_it:
}
-/* cleanup doAction calling parameters
- * rgerhards, 2009-05-07
+/* free a batches ressources, but not string buffers (because they will
+ * most probably be reused). String buffers are only deleted upon final
+ * destruction of the batch.
+ * This function here must be called only when the batch is actually no
+ * longer used, also not for retrying actions or such. It invalidates
+ * buffers.
+ * rgerhards, 2010-12-17
*/
-static rsRetVal cleanupDoActionParams(action_t *pAction, uchar ***ppMsgs)
+static rsRetVal releaseBatch(action_t *pAction, batch_t *pBatch)
{
int iArr;
- int i;
+ int i, j;
+ batch_obj_t *pElem;
+ uchar ***ppMsgs;
DEFiRet;
ASSERT(pAction != NULL);
- for(i = 0 ; i < pAction->iNumTpls ; ++i) {
- if(((uchar**)ppMsgs)[i] != NULL) {
- iArr = 0;
- while((((uchar***)ppMsgs)[i][iArr]) != NULL) {
- d_free(((uchar ***)ppMsgs)[i][iArr++]);
- ((uchar ***)ppMsgs)[i][iArr++] = NULL;
+ for(i = 0 ; i < batchNumMsgs(pBatch) && !*(pBatch->pbShutdownImmediate) ; ++i) {
+ pElem = &(pBatch->pElem[i]);
+ if(pElem->bFilterOK && pElem->state != BATCH_STATE_DISC) {
+ switch(pAction->eParamPassing) {
+ case ACT_ARRAY_PASSING:
+ ppMsgs = (uchar***) pElem->staticActParams;
+ for(i = 0 ; i < pAction->iNumTpls ; ++i) {
+ if(((uchar**)ppMsgs)[i] != NULL) {
+ iArr = 0;
+ while(ppMsgs[i][iArr] != NULL) {
+ d_free(ppMsgs[i][iArr++]);
+ ppMsgs[i][iArr++] = NULL;
+ }
+ d_free(((uchar**)ppMsgs)[i]);
+ ((uchar**)ppMsgs)[i] = NULL;
+ }
+ }
+ break;
+ case ACT_STRING_PASSING:
+ case ACT_MSG_PASSING:
+ /* nothing to do in that case */
+ /* TODO ... and yet we do something ;) This is considered not
+ * really needed, but I was not bold enough to remove that while
+ * fixing the stable. It should be removed in a devel version
+ * soon (I really don't see a reason why we would need it).
+ * rgerhards, 2010-12-16
+ */
+ for(j = 0 ; j < pAction->iNumTpls ; ++j) {
+ ((uchar**)pElem->staticActParams)[j] = NULL;
+ }
+ break;
}
- d_free(((uchar**)ppMsgs)[i]);
- ((uchar**)ppMsgs)[i] = NULL;
}
}
@@ -728,7 +760,6 @@ static rsRetVal cleanupDoActionParams(action_t *pAction, uchar ***ppMsgs)
rsRetVal
actionCallDoAction(action_t *pThis, msg_t *pMsg, void *actParams)
{
- int i;
DEFiRet;
ASSERT(pThis != NULL);
@@ -737,10 +768,7 @@ actionCallDoAction(action_t *pThis, msg_t *pMsg, void *actParams)
DBGPRINTF("entering actionCalldoAction(), state: %s\n", getActStateName(pThis));
pThis->bHadAutoCommit = 0;
-//d_pthread_mutex_lock(&pThis->mutActExec);
-//pthread_cleanup_push(mutexCancelCleanup, &pThis->mutActExec);
iRet = pThis->pMod->mod.om.doAction(actParams, pMsg->msgFlags, pThis->pModData);
-//pthread_cleanup_pop(1); /* unlock mutex */
switch(iRet) {
case RS_RET_OK:
actionCommitted(pThis);
@@ -769,34 +797,6 @@ actionCallDoAction(action_t *pThis, msg_t *pMsg, void *actParams)
iRet = getReturnCode(pThis);
finalize_it:
-
- /* we need to cleanup the batches string buffers if they have been used
- * in a non-standard way. -- rgerhards, 2010-06-15
- * Note that we may do this at the batch level, this would provide a bit
- * more concurrency (TODO).
- */
- switch(pThis->eParamPassing) {
- case ACT_STRING_PASSING:
- /* nothing to do in this case */
- /* TODO: find a better way of handling this situation, as it
- * costs performance to delete this array each time.
- */
- for(i = 0 ; i < pThis->iNumTpls ; ++i) {
- free(((uchar**)actParams)[i]);
- ((uchar**)actParams)[i] = NULL;
- }
- break;
- case ACT_ARRAY_PASSING:
- cleanupDoActionParams(pThis, actParams); /* iRet ignored! */
- break;
- case ACT_MSG_PASSING:
- /* (almost) nothing to do in that case */
- for(i = 0 ; i < pThis->iNumTpls ; ++i) {
- ((uchar**)actParams)[i] = NULL;
- }
- break;
- }
-
RETiRet;
}
@@ -959,10 +959,12 @@ submitBatch(action_t *pAction, batch_t *pBatch, int nElem)
int i;
int bDone;
rsRetVal localRet;
+ int wasDoneTo;
DEFiRet;
assert(pBatch != NULL);
+ wasDoneTo = pBatch->iDoneUpTo;
bDone = 0;
do {
localRet = tryDoAction(pAction, pBatch, &nElem);
@@ -986,7 +988,7 @@ submitBatch(action_t *pAction, batch_t *pBatch, int nElem)
; /* do nothing, this will retry the full batch */
} else if(localRet == RS_RET_ACTION_FAILED) {
/* in this case, everything not yet committed is BAD */
- for(i = pBatch->iDoneUpTo ; i < nElem ; ++i) {
+ for(i = pBatch->iDoneUpTo ; i < wasDoneTo + nElem ; ++i) {
if( pBatch->pElem[i].state != BATCH_STATE_DISC
&& pBatch->pElem[i].state != BATCH_STATE_COMM ) {
pBatch->pElem[i].state = BATCH_STATE_BAD;
@@ -996,7 +998,6 @@ submitBatch(action_t *pAction, batch_t *pBatch, int nElem)
bDone = 1;
} else {
if(nElem == 1) {
-#warning: fix this in master as well!
batchSetElemState(pBatch, pBatch->iDoneUpTo, BATCH_STATE_BAD);
bDone = 1;
} else {
@@ -1037,8 +1038,7 @@ prepareBatch(action_t *pAction, batch_t *pBatch)
pElem = &(pBatch->pElem[i]);
if(pElem->bFilterOK && pElem->state != BATCH_STATE_DISC) {
pElem->state = BATCH_STATE_RDY;
- prepareDoActionParams(pAction, (msg_t*) pElem->pUsrp,
- (uchar**) &(pElem->staticActParams), pElem->staticLenParams);
+ prepareDoActionParams(pAction, pElem);
}
}
RETiRet;
@@ -1071,6 +1071,7 @@ static rsRetVal
processBatchMain(action_t *pAction, batch_t *pBatch, int *pbShutdownImmediate)
{
int *pbShutdownImmdtSave;
+ rsRetVal localRet;
DEFiRet;
assert(pBatch != NULL);
@@ -1092,6 +1093,16 @@ processBatchMain(action_t *pAction, batch_t *pBatch, int *pbShutdownImmediate)
pthread_cleanup_pop(1); /* unlock mutex */
+ /* even if processAction failed, we need to release the batch (else we
+ * have a memory leak). So we do this first, and then check if we need to
+ * return an error code. If so, the code from processAction has priority.
+ * rgerhards, 2010-12-17
+ */
+ localRet = releaseBatch(pAction, pBatch);
+
+ if(iRet == RS_RET_OK)
+ iRet = localRet;
+
finalize_it:
pBatch->pbShutdownImmediate = pbShutdownImmdtSave;
RETiRet;
@@ -1376,7 +1387,7 @@ doSubmitToActionQNotAllMarkBatch(action_t *pAction, batch_t *pBatch)
int i;
int bProcessMarkMsgs = 0;
int bModifiedFilter;
- sbool FilterSave[128];
+ sbool FilterSave[1024];
sbool *pFilterSave;
DEFiRet;
@@ -1421,6 +1432,7 @@ doSubmitToActionQNotAllMarkBatch(action_t *pAction, batch_t *pBatch)
if(bModifiedFilter) {
/* in this case, we need to restore previous state */
for(i = 0 ; i < batchNumMsgs(pBatch) ; ++i) {
+ /* note: clang static code analyzer reports a false positive below */
pBatch->pElem[i].bFilterOK = pFilterSave[i];
}
}
diff --git a/configure.ac b/configure.ac
index f4ac6657..2637d38d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -526,7 +526,7 @@ AC_SUBST(PGSQL_LIBS)
# oracle (OCI) support
AC_ARG_ENABLE(oracle,
- [AS_HELP_STRING([--enable-oracle],[Enable native Oracle database support @<:@default=no@:>@])],
+ [AS_HELP_STRING([--enable-oracle],[Enable native Oracle database support @<:@default=no@:>@]. (Check your ORACLE_HOME environment variable!))],
[case "${enableval}" in
yes) enable_oracle="yes" ;;
no) enable_oracle="no" ;;
@@ -535,23 +535,41 @@ AC_ARG_ENABLE(oracle,
[enable_oracle=no]
)
if test "x$enable_oracle" = "xyes"; then
- AC_CHECK_PROG(
- [HAVE_ORACLE_CONFIG],
- [oracle-instantclient-config],
- [yes],,,
- )
- if test "x${HAVE_ORACLE_CONFIG}" != "xyes"; then
- AC_MSG_FAILURE([oracle-instantclient-config not found in PATH])
+ if test -d "$ORACLE_HOME"
+ then
+ AC_CHECK_LIB([occi], [OCIEnvCreate],
+ [ORACLE_CFLAGS=-I$ORACLE_HOME/rdbms/public]
+ [ORACLE_LIBS=-L$ORACLE_HOME/lib -locci],
+ [AC_MSG_FAILURE([Oracle (OCI) library is missing: wrong oracle home])],
+ [-I$ORACLE_HOME/rdbms/public/ -L$ORACLE_HOME/lib -locci -lclntsh ]
+ )
+ elif test -d "$ORACLE_LIB_PATH" -a -d "$ORACLE_INCLUDE_PATH"
+ then
+ AC_CHECK_LIB([occi], [OCIEnvCreate],
+ [ORACLE_CFLAGS=-I$ORACLE_INCLUDE_PATH]
+ [ORACLE_LIBS=-L$ORACLE_LIB_PATH -locci],
+ [AC_MSG_FAILURE([Oracle (OCI) library is missing: wrong oracle directories])],
+ [-I$ORACLE_INCLUDE_PATH -L$ORACLE_LIB_PATH -locci -lclntsh ]
+ )
+ else
+ AC_CHECK_PROG(
+ [HAVE_ORACLE_CONFIG],
+ [oracle-instantclient-config],
+ [yes],,,
+ )
+ if test "x${HAVE_ORACLE_CONFIG}" != "xyes"; then
+ AC_MSG_FAILURE([oracle-instantclient-config not found in PATH])
+ fi
+ AC_CHECK_LIB(
+ [occi],
+ [OCIEnvCreate],
+ [ORACLE_CFLAGS="`oracle-instantclient-config --cflags`"
+ ORACLE_LIBS="`oracle-instantclient-config --libs`"
+ ],
+ [AC_MSG_FAILURE([Oracle (OCI) libraray is missing])],
+ [`oracle-instantclient-config --libs --cflags`]
+ )
fi
- AC_CHECK_LIB(
- [occi],
- [OCIEnvCreate],
- [ORACLE_CFLAGS="`oracle-instantclient-config --cflags`"
- ORACLE_LIBS="`oracle-instantclient-config --libs`"
- ],
- [AC_MSG_FAILURE([Oracle (OCI) libraray is missing])],
- [`oracle-instantclient-config --libs --cflags`]
- )
fi
AM_CONDITIONAL(ENABLE_ORACLE, test x$enable_oracle = xyes)
AC_SUBST(ORACLE_CFLAGS)
diff --git a/doc/rsyslog_conf_filter.html b/doc/rsyslog_conf_filter.html
index 27f4a8a6..fbced4a3 100644
--- a/doc/rsyslog_conf_filter.html
+++ b/doc/rsyslog_conf_filter.html
@@ -85,12 +85,12 @@ selector field is capable to overwrite the preceding ones. Using this
behavior you can exclude some priorities from the pattern.</p>
<p>Rsyslogd has a syntax extension to the original BSD source,
that makes its use more intuitively. You may precede every priority
-with an equation sign ("='') to specify only this single priority and
+with an equals sign ("='') to specify only this single priority and
not any of the above. You may also (both is valid, too) precede the
priority with an exclamation mark ("!'') to ignore all that
priorities, either exact this one or this and any higher priority. If
you use both extensions than the exclamation mark must occur before the
-equation sign, just use it intuitively.</p>
+equals sign, just use it intuitively.</p>
<h3>Property-Based Filters</h3>
<p>Property-based filters are unique to rsyslogd. They allow to
filter on any property, like HOSTNAME, syslogtag and msg. A list of all
diff --git a/doc/rsyslog_conf_global.html b/doc/rsyslog_conf_global.html
index b71fc761..7d121a4a 100644
--- a/doc/rsyslog_conf_global.html
+++ b/doc/rsyslog_conf_global.html
@@ -162,6 +162,12 @@ Usually that should not be a big issue, as the restart-type HUP can easily be re
something along the lines of &quot;/etc/init.d/rsyslog restart&quot;.
</li>
<li><a href="rsconf1_includeconfig.html">$IncludeConfig</a></li><li>MainMsgQueueCheckpointInterval &lt;number&gt;</li>
+<li><b>$LocalHostName</b> [name] - this directive permits to overwrite the system
+hostname with the one specified in the directive. If the directive is given
+multiple times, all but the last one will be ignored. Please note that startup
+error messages may be issued with the real hostname. This is by design and not
+a bug (but one may argue if the design should be changed ;)). Available since
+4.7.4+, 5.7.3+, 6.1.3+.
<li><b>$LogRSyslogStatusMessages</b> [<b>on</b>/off] - If set to on (the default),
rsyslog emits message on startup and shutdown as well as when it is HUPed.
This information might be needed by some log analyzers. If set to off, no such
diff --git a/plugins/imklog/ksym.c b/plugins/imklog/ksym.c
index 058b2cfa..ebaec011 100644
--- a/plugins/imklog/ksym.c
+++ b/plugins/imklog/ksym.c
@@ -651,8 +651,7 @@ static void FreeSymbols(void)
**************************************************************************/
extern char *ExpandKadds(char *line, char *el)
{
- auto char dlm,
- *kp,
+ auto char *kp,
*sl = line,
*elp = el,
*symbol;
@@ -782,7 +781,6 @@ extern char *ExpandKadds(char *line, char *el)
strcpy(el, sl);
return(el);
}
- dlm = *kp;
strncpy(num,sl+1,kp-sl-1);
num[kp-sl-1] = '\0';
value = strtoul(num, (char **) 0, 16);
diff --git a/plugins/imudp/imudp.c b/plugins/imudp/imudp.c
index 5b7131de..b960322e 100644
--- a/plugins/imudp/imudp.c
+++ b/plugins/imudp/imudp.c
@@ -79,6 +79,8 @@ static uchar *pRcvBuf = NULL; /* receive buffer (for a single packet). We use a
*/
static prop_t *pInputName = NULL; /* our inputName currently is always "imudp", and this will hold it */
static ruleset_t *pBindRuleset = NULL; /* ruleset to bind listener to (use system default if unspecified) */
+static uchar *pszSchedPolicy = NULL; /**< scheduling policy (string) */
+static int iSchedPrio = -1; /**< scheduling priority (must not be negative) */
#define TIME_REQUERY_DFLT 2
static int iTimeRequery = TIME_REQUERY_DFLT;/* how often is time to be queried inside tight recv loop? 0=always */
@@ -446,6 +448,7 @@ ENDrunInput
/* initialize and return if will run or not */
BEGINwillRun
+ struct sched_param sparam;
CODESTARTwillRun
/* we need to create the inputName property (only once during our lifetime) */
CHKiRet(prop.Construct(&pInputName));
@@ -454,6 +457,40 @@ CODESTARTwillRun
net.PrintAllowedSenders(1); /* UDP */
net.HasRestrictions(UCHAR_CONSTANT("UDP"), &bDoACLCheck); /* UDP */
+
+ if(pszSchedPolicy == NULL) {
+ if(iSchedPrio != -1) {
+ errmsg.LogError(errno, NO_ERRCODE, "imudp: scheduling policy not set, but "
+ "priority - ignoring settings");
+ }
+ } else {
+ if(iSchedPrio == -1) {
+ errmsg.LogError(errno, NO_ERRCODE, "imudp: scheduling policy set, but no "
+ "priority - ignoring settings");
+ }
+ sparam.sched_priority = iSchedPrio;
+ dbgprintf("imudp trying to set sched policy to '%s', prio %d\n",
+ pszSchedPolicy, iSchedPrio);
+ if(0) { /* trick to use conditional compilation */
+# ifdef SCHED_FIFO
+ } else if(!strcasecmp((char*)pszSchedPolicy, "fifo")) {
+ pthread_setschedparam(pthread_self(), SCHED_FIFO, &sparam);
+# endif
+# ifdef SCHED_RR
+ } else if(!strcasecmp((char*)pszSchedPolicy, "rr")) {
+ pthread_setschedparam(pthread_self(), SCHED_RR, &sparam);
+# endif
+# ifdef SCHED_OTHER
+ } else if(!strcasecmp((char*)pszSchedPolicy, "other")) {
+ pthread_setschedparam(pthread_self(), SCHED_OTHER, &sparam);
+# endif
+ } else {
+ errmsg.LogError(errno, NO_ERRCODE, "imudp: invliad scheduling policy '%s' "
+ "ignoring settings", pszSchedPolicy);
+ }
+ free(pszSchedPolicy);
+ pszSchedPolicy = NULL;
+ }
/* if we could not set up any listners, there is no point in running... */
if(udpLstnSocks == NULL)
@@ -539,6 +576,10 @@ CODEmodInit_QueryRegCFSLineHdlr
addListner, NULL, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"udpserveraddress", 0, eCmdHdlrGetWord,
NULL, &pszBindAddr, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"imudpschedulingpolicy", 0, eCmdHdlrGetWord,
+ NULL, &pszSchedPolicy, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"imudpschedulingpriority", 0, eCmdHdlrInt,
+ NULL, &iSchedPrio, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"udpservertimerequery", 0, eCmdHdlrInt,
NULL, &iTimeRequery, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler,
diff --git a/plugins/omoracle/omoracle.c b/plugins/omoracle/omoracle.c
index 48ee1fa4..30b5834b 100644
--- a/plugins/omoracle/omoracle.c
+++ b/plugins/omoracle/omoracle.c
@@ -127,6 +127,13 @@ typedef struct _instanceData {
struct oracle_batch batch;
} instanceData;
+/* To be honest, strlcpy is faster than strncpy and makes very easy to
+ * detect if a message has been truncated. */
+#ifndef strlcpy
+#define strlcpy(dst,src,sz) snprintf((dst), (sz), "%s", (src))
+#endif
+
+
/** Database name, to be filled by the $OmoracleDB directive */
static char* db_name;
/** Database user name, to be filled by the $OmoracleDBUser
@@ -529,7 +536,7 @@ CODE_STD_FINALIZERparseSelectorAct
ENDparseSelectorAct
BEGINdoAction
- int i;
+ int i, sz;
char **params = (char**) ppString[0];
CODESTARTdoAction
@@ -540,9 +547,13 @@ CODESTARTdoAction
for (i = 0; i < pData->batch.arguments && params[i]; i++) {
dbgprintf("batch[%d][%d]=%s\n", i, pData->batch.n, params[i]);
- strncpy(pData->batch.parameters[i][pData->batch.n], params[i],
- pData->batch.param_size);
- CHKmalloc(pData->batch.parameters[i][pData->batch.n]);
+ sz = strlcpy(pData->batch.parameters[i][pData->batch.n],
+ params[i], pData->batch.param_size);
+ if (sz >= pData->batch.param_size)
+ errmsg.LogError(0, NO_ERRCODE,
+ "Possibly truncated %d column of '%s' "
+ "statement: %s", i,
+ pData->txt_statement, params[i]);
}
pData->batch.n++;
diff --git a/plugins/omtesting/omtesting.c b/plugins/omtesting/omtesting.c
index 9bb77fcc..4b763b2e 100644
--- a/plugins/omtesting/omtesting.c
+++ b/plugins/omtesting/omtesting.c
@@ -198,8 +198,10 @@ CODESTARTdoAction
break;
case MD_RANDFAIL:
iRet = doRandFail();
+ break;
case MD_ALWAYS_SUSPEND:
iRet = RS_RET_SUSPENDED;
+ break;
}
if(iRet == RS_RET_OK && pData->bEchoStdout) {
diff --git a/rsyslog.service.in b/rsyslog.service.in
index b3c55515..2bcde528 100644
--- a/rsyslog.service.in
+++ b/rsyslog.service.in
@@ -3,6 +3,7 @@ Description=System Logging Service
[Service]
ExecStart=@sbindir@/rsyslogd -n -c5
+ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target
diff --git a/runtime/atomic.h b/runtime/atomic.h
index 790cb1c6..3e2c0d18 100644
--- a/runtime/atomic.h
+++ b/runtime/atomic.h
@@ -46,7 +46,6 @@
# define ATOMIC_INC(data, phlpmut) ((void) __sync_fetch_and_add(data, 1))
# define ATOMIC_INC_AND_FETCH_int(data, phlpmut) __sync_fetch_and_add(data, 1)
# define ATOMIC_INC_AND_FETCH_unsigned(data, phlpmut) __sync_fetch_and_add(data, 1)
-# define ATOMIC_INC_AND_FETCH_uint64(data, phlpmut) __sync_fetch_and_add(data, 1)
# define ATOMIC_DEC(data, phlpmut) ((void) __sync_sub_and_fetch(data, 1))
# define ATOMIC_DEC_AND_FETCH(data, phlpmut) __sync_sub_and_fetch(data, 1)
# define ATOMIC_FETCH_32BIT(data, phlpmut) ((unsigned) __sync_fetch_and_and(data, 0xffffffff))
@@ -160,15 +159,6 @@
return(val);
}
- static inline unsigned
- ATOMIC_INC_AND_FETCH_uint64(uint64 *data, pthread_mutex_t *phlpmut) {
- uint64 val;
- pthread_mutex_lock(phlpmut);
- val = ++(*data);
- pthread_mutex_unlock(phlpmut);
- return(val);
- }
-
static inline int
ATOMIC_DEC_AND_FETCH(int *data, pthread_mutex_t *phlpmut) {
int val;
@@ -193,13 +183,6 @@
(*data) -= val;
pthread_mutex_unlock(phlpmut);
}
-#if 0
-# warning "atomic builtins not available, using nul operations - rsyslogd will probably be racy!"
-# define ATOMIC_INC_AND_FETCH_int(data) (++(data))
-# define ATOMIC_INC_AND_FETCH_unsigned(data) (++(data))
-# define ATOMIC_INC_AND_FETCH_uint64(data) (++(data))
-# define ATOMIC_STORE_1_TO_32BIT(data) (data) = 1 // TODO: del
-#endif
# define DEF_ATOMIC_HELPER_MUT(x) pthread_mutex_t x
# define INIT_ATOMIC_HELPER_MUT(x) pthread_mutex_init(&(x), NULL)
# define DESTROY_ATOMIC_HELPER_MUT(x) pthread_mutex_destroy(&(x))
@@ -208,4 +191,41 @@
#endif
+/* we need to handle 64bit atomics seperately as some platforms have
+ * 32 bit atomics, but not 64 biot ones... -- rgerhards, 2010-12-01
+ */
+#ifdef HAVE_ATOMIC_BUILTINS_64BIT
+# define ATOMIC_INC_uint64(data, phlpmut) ((void) __sync_fetch_and_add(data, 1))
+# define ATOMIC_DEC_unit64(data, phlpmut) ((void) __sync_sub_and_fetch(data, 1))
+# define ATOMIC_INC_AND_FETCH_uint64(data, phlpmut) __sync_fetch_and_add(data, 1)
+
+# define DEF_ATOMIC_HELPER_MUT64(x)
+# define INIT_ATOMIC_HELPER_MUT64(x)
+# define DESTROY_ATOMIC_HELPER_MUT64(x)
+#else
+# define ATOMIC_INC_uint64(data, phlpmut) { \
+ pthread_mutex_lock(phlpmut); \
+ ++(*(data)); \
+ pthread_mutex_unlock(phlpmut); \
+ }
+# define ATOMIC_DEC_uint64(data, phlpmut) { \
+ pthread_mutex_lock(phlpmut); \
+ --(*(data)); \
+ pthread_mutex_unlock(phlpmut); \
+ }
+
+ static inline unsigned
+ ATOMIC_INC_AND_FETCH_uint64(uint64 *data, pthread_mutex_t *phlpmut) {
+ uint64 val;
+ pthread_mutex_lock(phlpmut);
+ val = ++(*data);
+ pthread_mutex_unlock(phlpmut);
+ return(val);
+ }
+
+# define DEF_ATOMIC_HELPER_MUT64(x) pthread_mutex_t x
+# define INIT_ATOMIC_HELPER_MUT64(x) pthread_mutex_init(&(x), NULL)
+# define DESTROY_ATOMIC_HELPER_MUT64(x) pthread_mutex_destroy(&(x))
+#endif /* #ifdef HAVE_ATOMIC_BUILTINS_64BIT */
+
#endif /* #ifndef INCLUDED_ATOMIC_H */
diff --git a/runtime/batch.h b/runtime/batch.h
index 68f48d8b..d0504f2b 100644
--- a/runtime/batch.h
+++ b/runtime/batch.h
@@ -53,9 +53,11 @@ struct batch_obj_s {
*/
sbool bFilterOK; /* work area for filter processing (per action, reused!) */
sbool bPrevWasSuspended;
- void *staticActParams[CONF_OMOD_NUMSTRINGS_MAXSIZE];
+ /* following are caches to save allocs if not absolutely necessary */
+ uchar *staticActStrings[CONF_OMOD_NUMSTRINGS_MAXSIZE]; /**< for strings */
/* a cache to save malloc(), if not absolutely necessary */
- size_t staticLenParams[CONF_OMOD_NUMSTRINGS_MAXSIZE];
+ void *staticActParams[CONF_OMOD_NUMSTRINGS_MAXSIZE]; /**< for anything else */
+ size_t staticLenStrings[CONF_OMOD_NUMSTRINGS_MAXSIZE];
/* and the same for the message length (if used) */
/* end action work variables */
};
@@ -152,7 +154,10 @@ batchFree(batch_t *pBatch) {
int j;
for(i = 0 ; i < pBatch->maxElem ; ++i) {
for(j = 0 ; j < CONF_OMOD_NUMSTRINGS_MAXSIZE ; ++j) {
- free(pBatch->pElem[i].staticActParams[j]);
+ /* staticActParams MUST be freed immediately (if required),
+ * so we do not need to do that!
+ */
+ free(pBatch->pElem[i].staticActStrings[j]);
}
}
free(pBatch->pElem);
diff --git a/runtime/cfsysline.c b/runtime/cfsysline.c
index 1743b818..3cdf50ee 100644
--- a/runtime/cfsysline.c
+++ b/runtime/cfsysline.c
@@ -970,8 +970,6 @@ finalize_it:
*/
void dbgPrintCfSysLineHandlers(void)
{
- DEFiRet;
-
cslCmd_t *pCmd;
cslCmdHdlr_t *pCmdHdlr;
linkedListCookie_t llCookieCmd;
@@ -980,11 +978,11 @@ void dbgPrintCfSysLineHandlers(void)
dbgprintf("Sytem Line Configuration Commands:\n");
llCookieCmd = NULL;
- while((iRet = llGetNextElt(&llCmdList, &llCookieCmd, (void*)&pCmd)) == RS_RET_OK) {
+ while(llGetNextElt(&llCmdList, &llCookieCmd, (void*)&pCmd) == RS_RET_OK) {
llGetKey(llCookieCmd, (void*) &pKey); /* TODO: using the cookie is NOT clean! */
dbgprintf("\tCommand '%s':\n", pKey);
llCookieCmdHdlr = NULL;
- while((iRet = llGetNextElt(&pCmd->llCmdHdlrs, &llCookieCmdHdlr, (void*)&pCmdHdlr)) == RS_RET_OK) {
+ while(llGetNextElt(&pCmd->llCmdHdlrs, &llCookieCmdHdlr, (void*)&pCmdHdlr) == RS_RET_OK) {
dbgprintf("\t\ttype : %d\n", pCmdHdlr->eType);
dbgprintf("\t\tpData: 0x%lx\n", (unsigned long) pCmdHdlr->pData);
dbgprintf("\t\tHdlr : 0x%lx\n", (unsigned long) pCmdHdlr->cslCmdHdlr);
@@ -993,7 +991,6 @@ void dbgPrintCfSysLineHandlers(void)
}
}
dbgprintf("\n");
- ENDfunc
}
diff --git a/runtime/conf.c b/runtime/conf.c
index e12cf82b..1d28a884 100644
--- a/runtime/conf.c
+++ b/runtime/conf.c
@@ -1100,7 +1100,7 @@ static rsRetVal cflineDoAction(uchar **p, action_t **ppAction)
DEFiRet;
modInfo_t *pMod;
omodStringRequest_t *pOMSR;
- action_t *pAction;
+ action_t *pAction = NULL;
void *pModData;
ASSERT(p != NULL);
@@ -1108,6 +1108,11 @@ static rsRetVal cflineDoAction(uchar **p, action_t **ppAction)
/* loop through all modules and see if one picks up the line */
pMod = module.GetNxtType(NULL, eMOD_OUT);
+ /* Note: clang static analyzer reports that pMod mybe == NULL. However, this is
+ * not possible, because we have the built-in output modules which are always
+ * present. Anyhow, we guard this by an assert. -- rgerhards, 2010-12-16
+ */
+ assert(pMod != NULL);
while(pMod != NULL) {
pOMSR = NULL;
iRet = pMod->mod.om.parseSelectorAct(p, &pModData, &pOMSR);
diff --git a/runtime/ctok.c b/runtime/ctok.c
index 6d97568e..19c9bd24 100644
--- a/runtime/ctok.c
+++ b/runtime/ctok.c
@@ -1,4 +1,4 @@
-/* cfgtok.c - helper class to tokenize an input stream - which surprisingly
+/* ctok.c - helper class to tokenize an input stream - which surprisingly
* currently does not work with streams but with string. But that will
* probably change over time ;) This class was originally written to support
* the expression module but may evolve when (if) the expression module is
@@ -267,7 +267,7 @@ ctokGetVar(ctok_t *pThis, ctok_token_t *pToken)
{
DEFiRet;
uchar c;
- cstr_t *pstrVal;
+ cstr_t *pstrVal = NULL;
ISOBJ_TYPE_assert(pThis, ctok);
ASSERT(pToken != NULL);
diff --git a/runtime/debug.c b/runtime/debug.c
index 5818dda9..3f1c23bd 100644
--- a/runtime/debug.c
+++ b/runtime/debug.c
@@ -157,9 +157,7 @@ static pthread_key_t keyCallStack;
*/
static void dbgMutexCancelCleanupHdlr(void *pmut)
{
- int ret;
- ret = pthread_mutex_unlock((pthread_mutex_t*) pmut);
- assert(ret == 0);
+ pthread_mutex_unlock((pthread_mutex_t*) pmut);
}
@@ -438,14 +436,13 @@ dbgMutLog_t *dbgMutLogFindHolder(pthread_mutex_t *pmut)
static inline void dbgMutexPreLockLog(pthread_mutex_t *pmut, dbgFuncDB_t *pFuncDB, int ln)
{
dbgMutLog_t *pHolder;
- dbgMutLog_t *pLog;
char pszBuf[128];
char pszHolderThrdName[64];
char *pszHolder;
pthread_mutex_lock(&mutMutLog);
pHolder = dbgMutLogFindHolder(pmut);
- pLog = dbgMutLogAddEntry(pmut, MUTOP_LOCKWAIT, pFuncDB, ln);
+ dbgMutLogAddEntry(pmut, MUTOP_LOCKWAIT, pFuncDB, ln);
if(pHolder == NULL)
pszHolder = "[NONE]";
@@ -474,7 +471,7 @@ static inline void dbgMutexLockLog(pthread_mutex_t *pmut, dbgFuncDB_t *pFuncDB,
dbgMutLogDelEntry(pLog);
/* add "lock" entry */
- pLog = dbgMutLogAddEntry(pmut, MUTOP_LOCK, pFuncDB, lockLn);
+ dbgMutLogAddEntry(pmut, MUTOP_LOCK, pFuncDB, lockLn);
dbgFuncDBAddMutexLock(pFuncDB, pmut, lockLn);
pthread_mutex_unlock(&mutMutLog);
if(bPrintMutexAction)
@@ -486,14 +483,13 @@ static inline void dbgMutexLockLog(pthread_mutex_t *pmut, dbgFuncDB_t *pFuncDB,
static inline void dbgMutexPreTryLockLog(pthread_mutex_t *pmut, dbgFuncDB_t *pFuncDB, int ln)
{
dbgMutLog_t *pHolder;
- dbgMutLog_t *pLog;
char pszBuf[128];
char pszHolderThrdName[64];
char *pszHolder;
pthread_mutex_lock(&mutMutLog);
pHolder = dbgMutLogFindHolder(pmut);
- pLog = dbgMutLogAddEntry(pmut, MUTOP_TRYLOCK, pFuncDB, ln);
+ dbgMutLogAddEntry(pmut, MUTOP_TRYLOCK, pFuncDB, ln);
if(pHolder == NULL)
pszHolder = "[NONE]";
@@ -522,7 +518,7 @@ static inline void dbgMutexTryLockLog(pthread_mutex_t *pmut, dbgFuncDB_t *pFuncD
dbgMutLogDelEntry(pLog);
/* add "lock" entry */
- pLog = dbgMutLogAddEntry(pmut, MUTOP_LOCK, pFuncDB, lockLn);
+ dbgMutLogAddEntry(pmut, MUTOP_LOCK, pFuncDB, lockLn);
dbgFuncDBAddMutexLock(pFuncDB, pmut, lockLn);
pthread_mutex_unlock(&mutMutLog);
if(bPrintMutexAction)
diff --git a/runtime/glbl.c b/runtime/glbl.c
index 42f02008..7dc17df4 100644
--- a/runtime/glbl.c
+++ b/runtime/glbl.c
@@ -65,6 +65,7 @@ static int option_DisallowWarning = 1; /* complain if message from disallowed se
static int bDisableDNS = 0; /* don't look up IP addresses of remote messages */
static prop_t *propLocalHostName = NULL;/* our hostname as FQDN - read-only after startup */
static uchar *LocalHostName = NULL;/* our hostname - read-only after startup */
+static uchar *LocalHostNameOverride = NULL;/* user-overridden hostname - read-only after startup */
static uchar *LocalFQDNName = NULL;/* our hostname as FQDN - read-only after startup */
static uchar *LocalDomain; /* our local domain name - read-only after startup */
static char **StripDomains = NULL;/* these domains may be stripped before writing logs - r/o after s.u., never touched by init */
@@ -179,14 +180,19 @@ GenerateLocalHostNameProperty(void)
prop.Destruct(&propLocalHostName);
CHKiRet(prop.Construct(&propLocalHostName));
- if(LocalHostName == NULL)
- pszName = (uchar*) "[localhost]";
- else {
- if(GetPreserveFQDN() == 1)
- pszName = LocalFQDNName;
- else
- pszName = LocalHostName;
+ if(LocalHostNameOverride == NULL) {
+ if(LocalHostName == NULL)
+ pszName = (uchar*) "[localhost]";
+ else {
+ if(GetPreserveFQDN() == 1)
+ pszName = LocalFQDNName;
+ else
+ pszName = LocalHostName;
+ }
+ } else { /* local hostname is overriden via config */
+ pszName = LocalHostNameOverride;
}
+ DBGPRINTF("GenerateLocalHostName uses '%s'\n", pszName);
CHKiRet(prop.SetString(propLocalHostName, pszName, ustrlen(pszName)));
CHKiRet(prop.ConstructFinalize(propLocalHostName));
@@ -322,6 +328,10 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a
free(pszDfltNetstrmDrvrCertFile);
pszDfltNetstrmDrvrCertFile = NULL;
}
+ if(LocalHostNameOverride != NULL) {
+ free(LocalHostNameOverride);
+ LocalHostNameOverride = NULL;
+ }
if(pszWorkDir != NULL) {
free(pszWorkDir);
pszWorkDir = NULL;
@@ -352,6 +362,7 @@ BEGINAbstractObjClassInit(glbl, 1, OBJ_IS_CORE_MODULE) /* class, version */
CHKiRet(regCfSysLineHdlr((uchar *)"defaultnetstreamdrivercafile", 0, eCmdHdlrGetWord, NULL, &pszDfltNetstrmDrvrCAF, NULL, eConfObjGlobal));
CHKiRet(regCfSysLineHdlr((uchar *)"defaultnetstreamdriverkeyfile", 0, eCmdHdlrGetWord, NULL, &pszDfltNetstrmDrvrKeyFile, NULL, eConfObjGlobal));
CHKiRet(regCfSysLineHdlr((uchar *)"defaultnetstreamdrivercertfile", 0, eCmdHdlrGetWord, NULL, &pszDfltNetstrmDrvrCertFile, NULL, eConfObjGlobal));
+ CHKiRet(regCfSysLineHdlr((uchar *)"localhostname", 0, eCmdHdlrGetWord, NULL, &LocalHostNameOverride, NULL, eConfObjGlobal));
CHKiRet(regCfSysLineHdlr((uchar *)"optimizeforuniprocessor", 0, eCmdHdlrBinary, NULL, &bOptimizeUniProc, NULL, eConfObjGlobal));
CHKiRet(regCfSysLineHdlr((uchar *)"preservefqdn", 0, eCmdHdlrBinary, NULL, &bPreserveFQDN, NULL, eConfObjGlobal));
CHKiRet(regCfSysLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, NULL, eConfObjGlobal));
@@ -376,6 +387,7 @@ BEGINObjClassExit(glbl, OBJ_IS_CORE_MODULE) /* class, version */
free(pszWorkDir);
if(LocalHostName != NULL)
free(LocalHostName);
+ free(LocalHostNameOverride);
if(LocalFQDNName != NULL)
free(LocalFQDNName);
objRelease(prop, CORE_COMPONENT);
diff --git a/runtime/msg.c b/runtime/msg.c
index 65ea101f..ad045dec 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -1558,7 +1558,7 @@ rsRetVal MsgSetPROCID(msg_t *pMsg, char* pszPROCID)
CHKiRet(cstrConstruct(&pMsg->pCSPROCID));
}
/* if we reach this point, we have the object */
- iRet = rsCStrSetSzStr(pMsg->pCSPROCID, (uchar*) pszPROCID);
+ CHKiRet(rsCStrSetSzStr(pMsg->pCSPROCID, (uchar*) pszPROCID));
CHKiRet(cstrFinalize(pMsg->pCSPROCID));
finalize_it:
@@ -3034,7 +3034,6 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
if(pTpe->data.field.options.bCSV) {
/* we need to obtain a private copy, as we need to at least add the double quotes */
int iBufLen;
- int i;
uchar *pBStart;
uchar *pDst;
uchar *pSrc;
@@ -3049,7 +3048,6 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
RET_OUT_OF_MEMORY;
}
pSrc = pRes;
- i = 0;
*pDst++ = '"'; /* starting quote */
while(*pSrc) {
if(*pSrc == '"')
diff --git a/runtime/parser.c b/runtime/parser.c
index f1a4bbf4..8776a25e 100644
--- a/runtime/parser.c
+++ b/runtime/parser.c
@@ -429,14 +429,12 @@ ParsePRI(msg_t *pMsg)
int pri;
uchar *msg;
int lenMsg;
- int iPriText;
DEFiRet;
/* pull PRI */
lenMsg = pMsg->iLenRawMsg;
msg = pMsg->pszRawMsg;
pri = DEFUPRI;
- iPriText = 0;
if(pMsg->msgFlags & NO_PRI_IN_RAW) {
/* In this case, simply do so as if the pri would be right at top */
MsgSetAfterPRIOffs(pMsg, 0);
diff --git a/runtime/queue.c b/runtime/queue.c
index 387c15c2..e4922f37 100644
--- a/runtime/queue.c
+++ b/runtime/queue.c
@@ -1131,7 +1131,7 @@ cancelWorkers(qqueue_t *pThis)
* done when *no* worker is running. So time for a shutdown... -- rgerhards, 2009-05-28
*/
DBGOPRINT((obj_t*) pThis, "checking to see if main queue DA worker pool needs to be cancelled\n");
- iRetLocal = wtpCancelAll(pThis->pWtpDA); /* returns immediately if all threads already have terminated */
+ wtpCancelAll(pThis->pWtpDA); /* returns immediately if all threads already have terminated */
}
RETiRet;
diff --git a/runtime/statsobj.h b/runtime/statsobj.h
index 7447cded..44c26bea 100644
--- a/runtime/statsobj.h
+++ b/runtime/statsobj.h
@@ -99,19 +99,19 @@ PROTOTYPEObj(statsobj);
*/
#define STATSCOUNTER_DEF(ctr, mut) \
intctr_t ctr; \
- DEF_ATOMIC_HELPER_MUT(mut);
+ DEF_ATOMIC_HELPER_MUT64(mut);
#define STATSCOUNTER_INIT(ctr, mut) \
- INIT_ATOMIC_HELPER_MUT(mut); \
+ INIT_ATOMIC_HELPER_MUT64(mut); \
ctr = 0;
#define STATSCOUNTER_INC(ctr, mut) \
if(GatherStats) \
- ATOMIC_INC(&ctr, &mut);
+ ATOMIC_INC_uint64(&ctr, &mut);
#define STATSCOUNTER_DEC(ctr, mut) \
if(GatherStats) \
- ATOMIC_DEC(&ctr, mut);
+ ATOMIC_DEC_uint64(&ctr, mut);
/* the next macro works only if the variable is already guarded
* by mutex (or the users risks a wrong result). It is assumed
diff --git a/template.c b/template.c
index 1ea2575a..86987e98 100644
--- a/template.c
+++ b/template.c
@@ -86,9 +86,9 @@ rsRetVal tplToString(struct template *pTpl, msg_t *pMsg, uchar **ppBuf, size_t *
DEFiRet;
struct templateEntry *pTpe;
size_t iBuf;
- unsigned short bMustBeFreed;
+ unsigned short bMustBeFreed = 0;
uchar *pVal;
- size_t iLenVal;
+ size_t iLenVal = 0;
assert(pTpl != NULL);
assert(pMsg != NULL);
@@ -1055,7 +1055,6 @@ void tplDeleteAll(void)
{
struct template *pTpl, *pTplDel;
struct templateEntry *pTpe, *pTpeDel;
- rsRetVal iRetLocal;
BEGINfunc
pTpl = tplRoot;
@@ -1078,7 +1077,7 @@ void tplDeleteAll(void)
case FIELD:
/* check if we have a regexp and, if so, delete it */
if(pTpeDel->data.field.has_regex != 0) {
- if((iRetLocal = objUse(regexp, LM_REGEXP_FILENAME)) == RS_RET_OK) {
+ if(objUse(regexp, LM_REGEXP_FILENAME) == RS_RET_OK) {
regexp.regfree(&(pTpeDel->data.field.re));
}
}
@@ -1106,7 +1105,6 @@ void tplDeleteNew(void)
{
struct template *pTpl, *pTplDel;
struct templateEntry *pTpe, *pTpeDel;
- rsRetVal iRetLocal;
BEGINfunc
@@ -1135,7 +1133,7 @@ void tplDeleteNew(void)
case FIELD:
/* check if we have a regexp and, if so, delete it */
if(pTpeDel->data.field.has_regex != 0) {
- if((iRetLocal = objUse(regexp, LM_REGEXP_FILENAME)) == RS_RET_OK) {
+ if(objUse(regexp, LM_REGEXP_FILENAME) == RS_RET_OK) {
regexp.regfree(&(pTpeDel->data.field.re));
}
}
diff --git a/tests/cfg4.testin b/tests/cfg4.testin
index a49c0fb6..2dc0e830 100644
--- a/tests/cfg4.testin
+++ b/tests/cfg4.testin
@@ -12,48 +12,6 @@
# If you do not load inputs, nothing happens!
# You may need to set the module load path if modules are not found.
-#$ModLoad immark # provides --MARK-- message capability
-#$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
-#$ModLoad imklog # kernel logging (formerly provided by rklogd)
-
-# Log all kernel messages to the console.
-# Logging much else clutters up the screen.
-#kern.* /dev/console
-
-# Log anything (except mail) of level info or higher.
-# Don't log private authentication messages!
-*.info;mail.none;authpriv.none;cron.none -/var/log/messages
-
-# The authpriv file has restricted access.
-authpriv.* /var/log/secure
-
-# Log all the mail messages in one place.
-mail.* -/var/log/maillog
-
-
-# Log cron stuff
-cron.* -/var/log/cron
-
-# Everybody gets emergency messages
-*.emerg *
-
-# Save news errors of level crit and higher in a special file.
-uucp,news.crit -/var/log/spooler
-
-# Save boot messages also to boot.log
-local7.* /var/log/boot.log
-
-# Remote Logging (we use TCP for reliable delivery)
-# An on-disk queue is created for this action. If the remote host is
-# down, messages are spooled to disk and sent when it is up again.
-#$WorkDirectory /rsyslog/spool # where to place spool files
-#$ActionQueueFileName uniqName # unique name prefix for spool files
-#$ActionQueueMaxDiskSpace 1g # 1gb space limit (use as much as possible)
-#$ActionQueueSaveOnShutdown on # save messages to disk on shutdown
-#$ActionQueueType LinkedList # run asynchronously
-#$ActionResumeRetryCount -1 # infinite retries if host is down
-# remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional
-#*.* @@remote-host:514
# ######### Receiving Messages from Remote Hosts ##########
@@ -63,5 +21,11 @@ local7.* /var/log/boot.log
#$InputTCPServerRun 514 # start up TCP listener at port 514
# UDP Syslog Server:
-#$ModLoad imudp.so # provides UDP syslog reception
-#$UDPServerRun 514 # start a UDP syslog server at standard port 514
+$ModLoad imudp.so # provides UDP syslog reception
+$ModLoad omoracle.so
+$UDPServerRun 514 # start a UDP syslog server at standard port 514
+
+$IncludeConfig /home/munoz/logging/rsyslog/20*conf
+$IncludeConfig /home/munoz/logging/rsyslog/30*conf
+
+#*.* ~
diff --git a/tests/testsuites/parse1.conf b/tests/testsuites/parse1.conf
index 947a05a8..094cd762 100644
--- a/tests/testsuites/parse1.conf
+++ b/tests/testsuites/parse1.conf
@@ -2,6 +2,7 @@ $ModLoad ../plugins/omstdout/.libs/omstdout
$IncludeConfig nettest.input.conf # This picks the to be tested input from the test driver!
$ErrorMessagesToStderr off
+$LocalHostName localhost
# use a special format that we can easily parse in expect
$template expect,"%PRI%,%syslogfacility-text%,%syslogseverity-text%,%timestamp%,%hostname%,%programname%,%syslogtag%,%msg%\n"
diff --git a/threads.c b/threads.c
index 4064fc7a..04ccb8d3 100644
--- a/threads.c
+++ b/threads.c
@@ -211,7 +211,6 @@ rsRetVal thrdCreate(rsRetVal (*thrdMain)(thrdInfo_t*), rsRetVal(*afterRun)(thrdI
{
DEFiRet;
thrdInfo_t *pThis;
- int i;
assert(thrdMain != NULL);
@@ -220,7 +219,7 @@ rsRetVal thrdCreate(rsRetVal (*thrdMain)(thrdInfo_t*), rsRetVal(*afterRun)(thrdI
pThis->pUsrThrdMain = thrdMain;
pThis->pAfterRun = afterRun;
pThis->bNeedsCancel = bNeedsCancel;
- i = pthread_create(&pThis->thrdID, NULL, thrdStarter, pThis);
+ pthread_create(&pThis->thrdID, NULL, thrdStarter, pThis);
CHKiRet(llAppend(&llThrds, NULL, pThis));
finalize_it:
diff --git a/tools/omfile.c b/tools/omfile.c
index 3a74550b..435424a9 100644
--- a/tools/omfile.c
+++ b/tools/omfile.c
@@ -416,7 +416,6 @@ prepareFile(instanceData *pData, uchar *newFileName)
}
} else {
/* file does not exist, create it (and eventually parent directories */
- fd = -1;
if(pData->bCreateDirs) {
/* We first need to create parent dirs if they are missing.
* We do not report any errors here ourselfs but let the code
diff --git a/tools/omfwd.c b/tools/omfwd.c
index 6a42292d..fb9c9217 100644
--- a/tools/omfwd.c
+++ b/tools/omfwd.c
@@ -532,7 +532,6 @@ finalize_it:
BEGINparseSelectorAct
uchar *q;
int i;
- int bErr;
rsRetVal localRet;
struct addrinfo;
TCPFRAMINGMODE tcp_framing = TCP_FRAMING_OCTET_STUFFING;
@@ -655,7 +654,6 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
}
/* now skip to template */
- bErr = 0;
while(*p && *p != ';' && *p != '#' && !isspace((int) *p))
++p; /*JUST SKIP*/
diff --git a/tools/omusrmsg.c b/tools/omusrmsg.c
index 10b26e37..c5a28a09 100644
--- a/tools/omusrmsg.c
+++ b/tools/omusrmsg.c
@@ -259,7 +259,6 @@ static rsRetVal wallmsg(uchar* pMsg, instanceData *pData)
}
}
close(ttyf);
- ttyf = -1;
}
}
diff --git a/tools/rsyslog.conf.5 b/tools/rsyslog.conf.5
index e8a4ab92..e17da974 100644
--- a/tools/rsyslog.conf.5
+++ b/tools/rsyslog.conf.5
@@ -200,11 +200,11 @@ to overwrite the preceding ones. Using this behavior you can exclude some
priorities from the pattern.
Rsyslogd has a syntax extension to the original BSD source, that makes its use
-more intuitively. You may precede every priority with an equation sign ('=') to
+more intuitively. You may precede every priority with an equals sign ('=') to
specify only this single priority and not any of the above. You may also (both
is valid, too) precede the priority with an exclamation mark ('!') to ignore
all that priorities, either exact this one or this and any higher priority. If
-you use both extensions than the exclamation mark must occur before the equation
+you use both extensions than the exclamation mark must occur before the equals
sign, just use it intuitively.
.SH ACTIONS
diff --git a/tools/syslogd.c b/tools/syslogd.c
index 53da16d8..36b48bde 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -2106,11 +2106,6 @@ static void printVersion(void)
#else
printf("\tFEATURE_LARGEFILE:\t\t\tNo\n");
#endif
-#ifdef USE_NETZIP
- printf("\tFEATURE_NETZIP (message compression):\tYes\n");
-#else
- printf("\tFEATURE_NETZIP (message compression):\tNo\n");
-#endif
#if defined(SYSLOG_INET) && defined(USE_GSSAPI)
printf("\tGSSAPI Kerberos 5 support:\t\tYes\n");
#else
@@ -2122,9 +2117,14 @@ static void printVersion(void)
printf("\tFEATURE_DEBUG (debug build, slow code):\tNo\n");
#endif
#ifdef HAVE_ATOMIC_BUILTINS
- printf("\tAtomic operations supported:\t\tYes\n");
+ printf("\t32bit Atomic operations supported:\tYes\n");
#else
- printf("\tAtomic operations supported:\t\tNo\n");
+ printf("\t32bit Atomic operations supported:\tNo\n");
+#endif
+#ifdef HAVE_ATOMIC_BUILTINS64
+ printf("\t64bit Atomic operations supported:\tYes\n");
+#else
+ printf("\t64bit Atomic operations supported:\tNo\n");
#endif
#ifdef RTINST
printf("\tRuntime Instrumentation (slow code):\tYes\n");
@@ -2587,7 +2587,7 @@ int realMain(int argc, char **argv)
}
}
- if ((argc -= optind))
+ if(argc - optind)
usage();
DBGPRINTF("rsyslogd %s startup, compatibility mode %d, module path '%s', cwd:%s\n",
@@ -2863,9 +2863,6 @@ int realMain(int argc, char **argv)
if(!iConfigVerify)
CHKiRet(doGlblProcessInit());
- /* re-generate local host name property, as the config may have changed our FQDN settings */
- glbl.GenerateLocalHostNameProperty();
-
CHKiRet(mainThread());
/* do any de-init's that need to be done AFTER this comment */