summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2010-12-17 13:20:55 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2010-12-17 13:20:55 +0100
commitbcc3b2aef74534cebc39f1351927756d144a7942 (patch)
tree9c182438089a48f4653be0a34cc6105348d26dfb /plugins
parentb9cc60deeb0201e263ee011a20b0bce4eb6001f4 (diff)
parent68c13f3f6a691c7f854e6fa4caff43295896dbde (diff)
downloadrsyslog-bcc3b2aef74534cebc39f1351927756d144a7942.tar.gz
rsyslog-bcc3b2aef74534cebc39f1351927756d144a7942.tar.xz
rsyslog-bcc3b2aef74534cebc39f1351927756d144a7942.zip
Merge branch 'v5-devel'
Conflicts: ChangeLog action.c plugins/imudp/imudp.c runtime/glbl.c
Diffstat (limited to 'plugins')
-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
4 files changed, 59 insertions, 7 deletions
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) {