diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | action.c | 9 | ||||
-rw-r--r-- | grammar/parserif.h | 1 | ||||
-rw-r--r-- | runtime/rsconf.c | 15 | ||||
-rw-r--r-- | runtime/rsyslog.h | 1 |
5 files changed, 27 insertions, 1 deletions
@@ -16,6 +16,8 @@ Version 7.5.7 [devel] 2013-11-?? previous implementation. This will also improve performance and/or lower system overhead on busy systems. Thanks to Pavel Levshin for the enhancement. +- now emit warning message if om with msg passing mode uses action queue + These can modify the message, and this causes races. - improved checking of queue config parameters on startup - bugfix: call to ruleset with async queue did not use the queue closes: http://bugzilla.adiscon.com/show_bug.cgi?id=443 @@ -69,7 +69,7 @@ * beast. * rgerhards, 2011-06-15 * - * Copyright 2007-2011 Rainer Gerhards and Adiscon GmbH. + * Copyright 2007-2013 Rainer Gerhards and Adiscon GmbH. * * This file is part of rsyslog. * @@ -114,6 +114,7 @@ #include "unicode-helper.h" #include "atomic.h" #include "ruleset.h" +#include "parserif.h" #include "statsobj.h" #define NO_TIME_PROVIDED 0 /* indicate we do not provide any cached time */ @@ -475,6 +476,12 @@ actionConstructFinalize(action_t *pThis, struct nvlst *lst) qqueueDbgPrint(pThis->pQueue); DBGPRINTF("Action %p: queue %p created\n", pThis, pThis->pQueue); + + if(pThis->eParamPassing == ACT_MSG_PASSING && pThis->pQueue->qType != QUEUETYPE_DIRECT) { + parser_warnmsg("module %s with message passing mode uses " + "non-direct queue. This most probably leads to undesired " + "results", (char*)modGetName(pThis->pMod)); + } /* and now reset the queue params (see comment in its function header!) */ actionResetQueueParams(); diff --git a/grammar/parserif.h b/grammar/parserif.h index 6c2c1365..21da0950 100644 --- a/grammar/parserif.h +++ b/grammar/parserif.h @@ -6,6 +6,7 @@ int yyparse(); char *cnfcurrfn; void dbgprintf(char *fmt, ...) __attribute__((format(printf, 1, 2))); void parser_errmsg(char *fmt, ...) __attribute__((format(printf, 1, 2))); +void parser_warnmsg(char *fmt, ...) __attribute__((format(printf, 1, 2))); void tellLexEndParsing(void); extern int yydebug; extern int yylineno; diff --git a/runtime/rsconf.c b/runtime/rsconf.c index 8c808786..b1016568 100644 --- a/runtime/rsconf.c +++ b/runtime/rsconf.c @@ -292,6 +292,21 @@ finalize_it: extern int yylineno; void +parser_warnmsg(char *fmt, ...) +{ + va_list ap; + char errBuf[1024]; + + va_start(ap, fmt); + if(vsnprintf(errBuf, sizeof(errBuf), fmt, ap) == sizeof(errBuf)) + errBuf[sizeof(errBuf)-1] = '\0'; + errmsg.LogError(0, RS_RET_CONF_PARSE_WARNING, + "warning during parsing file %s, on or before line %d: %s", + cnfcurrfn, yylineno, errBuf); + va_end(ap); +} + +void parser_errmsg(char *fmt, ...) { va_list ap; diff --git a/runtime/rsyslog.h b/runtime/rsyslog.h index edf0c593..bf1c35bf 100644 --- a/runtime/rsyslog.h +++ b/runtime/rsyslog.h @@ -381,6 +381,7 @@ enum rsRetVal_ /** return value. All methods return this if not specified oth RS_RET_ERR_UDPSEND = -2354,/**< sending msg via UDP failed */ RS_RET_LAST_ERRREPORT = -2355,/**< module does not emit more error messages as limit is reached */ RS_RET_READ_ERR = -2356,/**< read error occured (file i/o) */ + RS_RET_CONF_PARSE_WARNING = -2357,/**< warning parsing config file */ /* RainerScript error messages (range 1000.. 1999) */ RS_RET_SYSVAR_NOT_FOUND = 1001, /**< system variable could not be found (maybe misspelled) */ |