summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-08-08 08:20:06 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-08-08 08:20:06 +0000
commitfed254a29f88d12d18b3e8dd06ef126bed219ed0 (patch)
tree19c947b5a259c00597580f884721aee2e64173a2
parent12c7e9ab4bba93e019f7f118d036d7dedcdf0037 (diff)
downloadrsyslog-fed254a29f88d12d18b3e8dd06ef126bed219ed0.tar.gz
rsyslog-fed254a29f88d12d18b3e8dd06ef126bed219ed0.tar.xz
rsyslog-fed254a29f88d12d18b3e8dd06ef126bed219ed0.zip
changed function name dprintf() to dbgprintf() as it conflicts with the
clib
-rw-r--r--action.c3
-rw-r--r--action.h2
-rw-r--r--cfsysline.c4
-rw-r--r--iminternal.c4
-rw-r--r--modules.c28
-rw-r--r--modules.h2
-rw-r--r--msg.c30
-rw-r--r--net.c8
-rw-r--r--omdiscard.c2
-rw-r--r--omfile.c16
-rw-r--r--omfwd.c44
-rw-r--r--ommysql.c4
-rw-r--r--omshell.c4
-rw-r--r--omusrmsg.c6
-rw-r--r--outchannel.c12
-rwxr-xr-xsrUtils.c4
-rw-r--r--syslogd.c230
-rw-r--r--syslogd.h6
-rw-r--r--tcpsyslog.c16
-rw-r--r--template.c98
20 files changed, 259 insertions, 264 deletions
diff --git a/action.c b/action.c
index 99e86c3d..639e5822 100644
--- a/action.c
+++ b/action.c
@@ -30,7 +30,6 @@
#include <time.h>
#include "rsyslog.h"
-#include "syslogd.h" /* to get the own definition of dprintf() - not a smart thing... */
#include "template.h"
#include "action.h"
#include "modules.h"
@@ -142,7 +141,7 @@ rsRetVal actionTryResume(action_t *pThis)
if(iRet == RS_RET_OK)
actionResume(pThis);
- dprintf("actionTryResume: iRet: %d, next retry (if applicable): %u [now %u]\n",
+ dbgprintf("actionTryResume: iRet: %d, next retry (if applicable): %u [now %u]\n",
iRet, (unsigned) pThis->ttResumeRtry, (unsigned) ttNow);
return iRet;
diff --git a/action.h b/action.h
index cda4130d..467404fc 100644
--- a/action.h
+++ b/action.h
@@ -69,7 +69,7 @@ inline int actionIsSuspended(action_t *pThis)
{
int i;
i = pThis->bSuspended == 1;
- dprintf("in IsSuspend(), returns %d\n", i);
+ dbgprintf("in IsSuspend(), returns %d\n", i);
return i;
}
#endif
diff --git a/cfsysline.c b/cfsysline.c
index 6244c2ee..84583190 100644
--- a/cfsysline.c
+++ b/cfsysline.c
@@ -265,7 +265,7 @@ static rsRetVal doGetGID(uchar **pp, rsRetVal (*pSetHdlr)(void*, uid_t), void *p
/* we set value via a set function */
CHKiRet(pSetHdlr(pVal, pgBuf->gr_gid));
}
- dprintf("gid %d obtained for group '%s'\n", pgBuf->gr_gid, szName);
+ dbgprintf("gid %d obtained for group '%s'\n", pgBuf->gr_gid, szName);
}
skipWhiteSpace(pp); /* skip over any whitespace */
@@ -307,7 +307,7 @@ static rsRetVal doGetUID(uchar **pp, rsRetVal (*pSetHdlr)(void*, uid_t), void *p
/* we set value via a set function */
CHKiRet(pSetHdlr(pVal, ppwBuf->pw_uid));
}
- dprintf("uid %d obtained for user '%s'\n", ppwBuf->pw_uid, szName);
+ dbgprintf("uid %d obtained for user '%s'\n", ppwBuf->pw_uid, szName);
}
skipWhiteSpace(pp); /* skip over any whitespace */
diff --git a/iminternal.c b/iminternal.c
index 2f898e46..a52fe741 100644
--- a/iminternal.c
+++ b/iminternal.c
@@ -105,7 +105,7 @@ rsRetVal iminternalAddMsg(int pri, msg_t *pMsg, int flags)
finalize_it:
if(iRet != RS_RET_OK) {
- dprintf("iminternalAddMsg() error %d - can not otherwise report this error, message lost\n", iRet);
+ dbgprintf("iminternalAddMsg() error %d - can not otherwise report this error, message lost\n", iRet);
if(pThis != NULL)
iminternalDestruct(pThis);
}
@@ -135,7 +135,7 @@ rsRetVal iminternalRemoveMsg(int *pPri, msg_t **ppMsg, int *pFlags)
pThis->pMsg = NULL; /* we do no longer own it - important for destructor */
if(llDestroyRootElt(&llMsgs) != RS_RET_OK) {
- dprintf("Root element of iminternal linked list could not be destroyed - there is "
+ dbgprintf("Root element of iminternal linked list could not be destroyed - there is "
"nothing we can do against it, we ignore it for now. Things may go wild "
"from here on. This is most probably a program logic error.\n");
}
diff --git a/modules.c b/modules.c
index ec816c43..6e4d0395 100644
--- a/modules.c
+++ b/modules.c
@@ -245,7 +245,7 @@ finalize_it:
/* Print loaded modules. This is more or less a
* debug or test aid, but anyhow I think it's worth it...
- * This only works if the dprintf() subsystem is initialized.
+ * This only works if the dbgprintf() subsystem is initialized.
*/
void modPrintList(void)
{
@@ -253,28 +253,28 @@ void modPrintList(void)
pMod = modGetNxt(NULL);
while(pMod != NULL) {
- dprintf("Loaded Module: Name='%s', IFVersion=%d, ",
+ dbgprintf("Loaded Module: Name='%s', IFVersion=%d, ",
(char*) modGetName(pMod), pMod->iIFVers);
- dprintf("type=");
+ dbgprintf("type=");
switch(pMod->eType) {
case eMOD_OUT:
- dprintf("output");
+ dbgprintf("output");
break;
case eMOD_IN:
- dprintf("input");
+ dbgprintf("input");
break;
case eMOD_FILTER:
- dprintf("filter");
+ dbgprintf("filter");
break;
}
- dprintf(" module.\n");
- dprintf("Entry points:\n");
- dprintf("\tqueryEtryPt: 0x%x\n", (unsigned) pMod->modQueryEtryPt);
- dprintf("\tdoAction: 0x%x\n", (unsigned) pMod->mod.om.doAction);
- dprintf("\tparseSelectorAct: 0x%x\n", (unsigned) pMod->mod.om.parseSelectorAct);
- dprintf("\tdbgPrintInstInfo: 0x%x\n", (unsigned) pMod->dbgPrintInstInfo);
- dprintf("\tfreeInstance: 0x%x\n", (unsigned) pMod->freeInstance);
- dprintf("\n");
+ dbgprintf(" module.\n");
+ dbgprintf("Entry points:\n");
+ dbgprintf("\tqueryEtryPt: 0x%x\n", (unsigned) pMod->modQueryEtryPt);
+ dbgprintf("\tdoAction: 0x%x\n", (unsigned) pMod->mod.om.doAction);
+ dbgprintf("\tparseSelectorAct: 0x%x\n", (unsigned) pMod->mod.om.parseSelectorAct);
+ dbgprintf("\tdbgPrintInstInfo: 0x%x\n", (unsigned) pMod->dbgPrintInstInfo);
+ dbgprintf("\tfreeInstance: 0x%x\n", (unsigned) pMod->freeInstance);
+ dbgprintf("\n");
pMod = modGetNxt(pMod); /* done, go next */
}
}
diff --git a/modules.h b/modules.h
index c05026ed..7837f0fd 100644
--- a/modules.h
+++ b/modules.h
@@ -50,7 +50,7 @@ typedef struct moduleInfo {
int iIFVers; /* Interface version of module */
eModType_t eType; /* type of this module */
eModLinkType_t eLinkType;
- uchar* pszName; /* printable module name, e.g. for dprintf */
+ uchar* pszName; /* printable module name, e.g. for dbgprintf */
/* functions supported by all types of modules */
rsRetVal (*modInit)(int, int*, rsRetVal(**)()); /* initialize the module */
/* be sure to support version handshake! */
diff --git a/msg.c b/msg.c
index 29277104..6a7e7c19 100644
--- a/msg.c
+++ b/msg.c
@@ -75,7 +75,7 @@ msg_t* MsgConstruct(void)
getCurrTime(&(pM->tRcvdAt));
}
- /* DEV debugging only! dprintf("MsgConstruct\t0x%x, ref 1\n", (int)pM);*/
+ /* DEV debugging only! dbgprintf("MsgConstruct\t0x%x, ref 1\n", (int)pM);*/
return(pM);
}
@@ -87,11 +87,11 @@ msg_t* MsgConstruct(void)
void MsgDestruct(msg_t * pM)
{
assert(pM != NULL);
- /* DEV Debugging only ! dprintf("MsgDestruct\t0x%x, Ref now: %d\n", (int)pM, pM->iRefCount - 1); */
+ /* DEV Debugging only ! dbgprintf("MsgDestruct\t0x%x, Ref now: %d\n", (int)pM, pM->iRefCount - 1); */
MsgLock();
if(--pM->iRefCount == 0)
{
- /* DEV Debugging Only! dprintf("MsgDestruct\t0x%x, RefCount now 0, doing DESTROY\n", (int)pM); */
+ /* DEV Debugging Only! dbgprintf("MsgDestruct\t0x%x, RefCount now 0, doing DESTROY\n", (int)pM); */
if(pM->pszUxTradMsg != NULL)
free(pM->pszUxTradMsg);
if(pM->pszRawMsg != NULL)
@@ -227,7 +227,7 @@ msg_t *MsgAddRef(msg_t *pM)
MsgLock();
pM->iRefCount++;
MsgUnlock();
- /* DEV debugging only! dprintf("MsgAddRef\t0x%x done, Ref now: %d\n", (int)pM, pM->iRefCount);*/
+ /* DEV debugging only! dbgprintf("MsgAddRef\t0x%x done, Ref now: %d\n", (int)pM, pM->iRefCount);*/
return(pM);
}
@@ -364,7 +364,7 @@ void setProtocolVersion(msg_t *pM, int iNewVersion)
{
assert(pM != NULL);
if(iNewVersion != 0 && iNewVersion != 1) {
- dprintf("Tried to set unsupported protocol version %d - changed to 0.\n", iNewVersion);
+ dbgprintf("Tried to set unsupported protocol version %d - changed to 0.\n", iNewVersion);
iNewVersion = 0;
}
pM->iProtocolVersion = iNewVersion;
@@ -830,7 +830,7 @@ void MsgSetTAG(msg_t *pMsg, char* pszTAG)
if((pMsg->pszTAG = malloc(pMsg->iLenTAG + 1)) != NULL)
memcpy(pMsg->pszTAG, pszTAG, pMsg->iLenTAG + 1);
else
- dprintf("Could not allocate memory in MsgSetTAG()\n");
+ dbgprintf("Could not allocate memory in MsgSetTAG()\n");
}
@@ -982,7 +982,7 @@ int getProgramNameLen(msg_t *pM)
assert(pM != NULL);
MsgLock();
if((iRet = aquireProgramName(pM)) != RS_RET_OK) {
- dprintf("error %d returned by aquireProgramName() in getProgramNameLen()\n", iRet);
+ dbgprintf("error %d returned by aquireProgramName() in getProgramNameLen()\n", iRet);
MsgUnlock();
return 0; /* best we can do (consistent wiht what getProgramName() returns) */
}
@@ -1002,7 +1002,7 @@ char *getProgramName(msg_t *pM)
assert(pM != NULL);
MsgLock();
if((iRet = aquireProgramName(pM)) != RS_RET_OK) {
- dprintf("error %d returned by aquireProgramName() in getProgramName()\n", iRet);
+ dbgprintf("error %d returned by aquireProgramName() in getProgramName()\n", iRet);
MsgUnlock();
return ""; /* best we can do */
}
@@ -1061,7 +1061,7 @@ void MsgSetHOSTNAME(msg_t *pMsg, char* pszHOSTNAME)
if((pMsg->pszHOSTNAME = malloc(pMsg->iLenHOSTNAME + 1)) != NULL)
memcpy(pMsg->pszHOSTNAME, pszHOSTNAME, pMsg->iLenHOSTNAME + 1);
else
- dprintf("Could not allocate memory in MsgSetHOSTNAME()\n");
+ dbgprintf("Could not allocate memory in MsgSetHOSTNAME()\n");
}
@@ -1093,7 +1093,7 @@ int MsgSetUxTradMsg(msg_t *pMsg, char* pszUxTradMsg)
if((pMsg->pszUxTradMsg = malloc(pMsg->iLenUxTradMsg + 1)) != NULL)
memcpy(pMsg->pszUxTradMsg, pszUxTradMsg, pMsg->iLenUxTradMsg + 1);
else
- dprintf("Could not allocate memory for pszUxTradMsg buffer.");
+ dbgprintf("Could not allocate memory for pszUxTradMsg buffer.");
return(0);
}
@@ -1113,7 +1113,7 @@ void MsgSetMSG(msg_t *pMsg, char* pszMSG)
if((pMsg->pszMSG = malloc(pMsg->iLenMSG + 1)) != NULL)
memcpy(pMsg->pszMSG, pszMSG, pMsg->iLenMSG + 1);
else
- dprintf("MsgSetMSG could not allocate memory for pszMSG buffer.");
+ dbgprintf("MsgSetMSG could not allocate memory for pszMSG buffer.");
}
/* rgerhards 2004-11-11: set RawMsg in msg object
@@ -1128,7 +1128,7 @@ void MsgSetRawMsg(msg_t *pMsg, char* pszRawMsg)
if((pMsg->pszRawMsg = malloc(pMsg->iLenRawMsg + 1)) != NULL)
memcpy(pMsg->pszRawMsg, pszRawMsg, pMsg->iLenRawMsg + 1);
else
- dprintf("Could not allocate memory for pszRawMsg buffer.");
+ dbgprintf("Could not allocate memory for pszRawMsg buffer.");
}
@@ -1388,7 +1388,7 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
++iCurrFld;
}
}
- dprintf("field requested %d, field found %d\n", pTpe->data.field.iToPos, iCurrFld);
+ dbgprintf("field requested %d, field found %d\n", pTpe->data.field.iToPos, iCurrFld);
if(iCurrFld == pTpe->data.field.iToPos) {
/* field found, now extract it */
@@ -1471,7 +1471,7 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
return
"**NO MATCH** **BAD REGULAR EXPRESSION**";
- dprintf("debug: String to match for regex is: %s\n",
+ dbgprintf("debug: String to match for regex is: %s\n",
pRes);
if (0 != regexec(&pTpe->data.field.re, pRes, nmatch,
@@ -1632,7 +1632,7 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
}
}
- /*dprintf("MsgGetProp(\"%s\"): \"%s\"\n", pName, pRes); only for verbose debug logging */
+ /*dbgprintf("MsgGetProp(\"%s\"): \"%s\"\n", pName, pRes); only for verbose debug logging */
return(pRes);
}
diff --git a/net.c b/net.c
index d540ad28..00a445ca 100644
--- a/net.c
+++ b/net.c
@@ -65,14 +65,14 @@ int should_use_so_bsdcompat(void)
init_done = 1;
if (uname(&utsname) < 0) {
- dprintf("uname: %s\r\n", strerror(errno));
+ dbgprintf("uname: %s\r\n", strerror(errno));
return 1;
}
/* Format is <version>.<patchlevel>.<sublevel><extraversion>
where the first three are unsigned integers and the last
is an arbitrary string. We only care about the first two. */
if (sscanf(utsname.release, "%u.%u", &version, &patchlevel) != 2) {
- dprintf("uname: unexpected release '%s'\r\n",
+ dbgprintf("uname: unexpected release '%s'\r\n",
utsname.release);
return 1;
}
@@ -123,7 +123,7 @@ int cvthname(struct sockaddr_storage *f, uchar *pszHost, uchar *pszHostFQDN)
ip, sizeof ip, NULL, 0, NI_NUMERICHOST);
if (error) {
- dprintf("Malformed from address %s\n", gai_strerror(error));
+ dbgprintf("Malformed from address %s\n", gai_strerror(error));
strcpy((char*) pszHost, "???");
strcpy((char*) pszHostFQDN, "???");
return 1;
@@ -186,7 +186,7 @@ int cvthname(struct sockaddr_storage *f, uchar *pszHost, uchar *pszHostFQDN)
}
if (error || DisableDNS) {
- dprintf("Host name for your address (%s) unknown\n", ip);
+ dbgprintf("Host name for your address (%s) unknown\n", ip);
strcpy((char*) pszHostFQDN, ip);
strcpy((char*) pszHost, ip);
return 1;
diff --git a/omdiscard.c b/omdiscard.c
index 75eb953c..7a21e46c 100644
--- a/omdiscard.c
+++ b/omdiscard.c
@@ -88,7 +88,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(0)
if(*p == '~') {
/* TODO: check the rest of the selector line - error reporting */
- dprintf("discard\n");
+ dbgprintf("discard\n");
} else {
iRet = RS_RET_CONFLINE_UNPROCESSED;
}
diff --git a/omfile.c b/omfile.c
index cd19aad0..aba68256 100644
--- a/omfile.c
+++ b/omfile.c
@@ -167,7 +167,7 @@ rsRetVal setDynaFileCacheSize(void __attribute__((unused)) *pVal, int iNewVal)
}
iDynaFileCacheSize = iNewVal;
- dprintf("DynaFileCacheSize changed to %d.\n", iNewVal);
+ dbgprintf("DynaFileCacheSize changed to %d.\n", iNewVal);
return iRet;
}
@@ -322,7 +322,7 @@ static void dynaFileDelCacheEntry(dynaFileCacheEntry **pCache, int iEntry, int b
if(pCache[iEntry] == NULL)
return;
- dprintf("Removed entry %d for file '%s' from dynaCache.\n", iEntry,
+ dbgprintf("Removed entry %d for file '%s' from dynaCache.\n", iEntry,
pCache[iEntry]->pName == NULL ? "[OPEN FAILED]" : (char*)pCache[iEntry]->pName);
/* if the name is NULL, this is an improperly initilized entry which
* needs to be discarded. In this case, neither the file is to be closed
@@ -427,7 +427,7 @@ static int prepareDynFile(instanceData *pData, uchar *newFileName, unsigned iMsg
pCache[iFirstFree] = (dynaFileCacheEntry*) calloc(1, sizeof(dynaFileCacheEntry));
if(pCache[iFirstFree] == NULL) {
glblHadMemShortage = TRUE;
- dprintf("prepareDynfile(): could not alloc mem, discarding this request\n");
+ dbgprintf("prepareDynfile(): could not alloc mem, discarding this request\n");
return -1;
}
}
@@ -478,7 +478,7 @@ static int prepareDynFile(instanceData *pData, uchar *newFileName, unsigned iMsg
* news is that we also lose errors on startup messages, but so it is.
*/
if(iMsgOpts & INTERNAL_MSG)
- dprintf("Could not open dynaFile, discarding message\n");
+ dbgprintf("Could not open dynaFile, discarding message\n");
else
logerrorSz("Could not open dynamic file '%s' - discarding message", (char*)newFileName);
dynaFileDelCacheEntry(pCache, iFirstFree, 1);
@@ -489,7 +489,7 @@ static int prepareDynFile(instanceData *pData, uchar *newFileName, unsigned iMsg
pCache[iFirstFree]->pName = (uchar*)strdup((char*)newFileName); /* TODO: check for NULL (very unlikely) */
pCache[iFirstFree]->lastUsed = time(NULL);
pData->iCurrElt = iFirstFree;
- dprintf("Added new entry %d for file cache, file '%s'.\n",
+ dbgprintf("Added new entry %d for file cache, file '%s'.\n",
iFirstFree, newFileName);
return 0;
@@ -628,7 +628,7 @@ ENDtryResume
BEGINdoAction
CODESTARTdoAction
- dprintf(" (%s)\n", pData->f_fname);
+ dbgprintf(" (%s)\n", pData->f_fname);
/* pData->fd == -1 is an indicator that the we couldn't
* open the file at startup. For dynaFiles, this is ok,
* all others are doomed.
@@ -712,7 +712,7 @@ CODESTARTparseSelectorAct
if((pData->dynCache = (dynaFileCacheEntry**)
calloc(iDynaFileCacheSize, sizeof(dynaFileCacheEntry*))) == NULL) {
iRet = RS_RET_OUT_OF_MEMORY;
- dprintf("Could not allocate memory for dynaFileCache - selector disabled.\n");
+ dbgprintf("Could not allocate memory for dynaFileCache - selector disabled.\n");
}
break;
@@ -746,7 +746,7 @@ CODESTARTparseSelectorAct
if ( pData->fd < 0 ){
pData->fd = -1;
- dprintf("Error opening log file: %s\n", pData->f_fname);
+ dbgprintf("Error opening log file: %s\n", pData->f_fname);
logerror(pData->f_fname);
break;
}
diff --git a/omfwd.c b/omfwd.c
index 33d4af8c..962ec166 100644
--- a/omfwd.c
+++ b/omfwd.c
@@ -232,7 +232,7 @@ static int TCPSendCreateSocket(instanceData *pData, struct addrinfo *addrDest)
TCPSendSetStatus(pData, TCP_SEND_CONNECTING);
return fd;
} else {
- dprintf("create tcp connection failed, reason %s",
+ dbgprintf("create tcp connection failed, reason %s",
strerror(errno));
}
@@ -244,12 +244,12 @@ static int TCPSendCreateSocket(instanceData *pData, struct addrinfo *addrDest)
close(fd);
}
else {
- dprintf("couldn't create send socket, reason %s", strerror(errno));
+ dbgprintf("couldn't create send socket, reason %s", strerror(errno));
}
r = r->ai_next;
}
- dprintf("no working socket could be obtained");
+ dbgprintf("no working socket could be obtained");
return -1;
}
@@ -433,7 +433,7 @@ static int TCPSend(instanceData *pData, char *msg, size_t len)
* very unlikely case. For this, it is justified just to loose
* the message. Rgerhards, 2006-12-07
*/
- dprintf("Error: out of memory when building TCP octet-counted "
+ dbgprintf("Error: out of memory when building TCP octet-counted "
"frame. Message is lost, trying to continue.\n");
return 0;
}
@@ -447,7 +447,7 @@ static int TCPSend(instanceData *pData, char *msg, size_t len)
/* frame building complete, on to actual sending */
lenSend = send(pData->sock, msg, len, 0);
- dprintf("TCP sent %d bytes, requested %d, msg: '%s'\n", lenSend, len,
+ dbgprintf("TCP sent %d bytes, requested %d, msg: '%s'\n", lenSend, len,
bIsCompressed ? "***compressed***" : msg);
if((unsigned)lenSend == len) {
/* all well */
@@ -460,7 +460,7 @@ static int TCPSend(instanceData *pData, char *msg, size_t len)
* For the time being, we ignore this...
* rgerhards, 2005-10-25
*/
- dprintf("message not completely (tcp)send, ignoring %d\n", lenSend);
+ dbgprintf("message not completely (tcp)send, ignoring %d\n", lenSend);
# if USE_PTHREADS
usleep(1000); /* experimental - might be benefitial in this situation */
# endif
@@ -471,7 +471,7 @@ static int TCPSend(instanceData *pData, char *msg, size_t len)
switch(errno) {
case EMSGSIZE:
- dprintf("message not (tcp)send, too large\n");
+ dbgprintf("message not (tcp)send, too large\n");
/* This is not a real error, so it is not flagged as one */
if(buf != NULL)
free(buf);
@@ -479,7 +479,7 @@ static int TCPSend(instanceData *pData, char *msg, size_t len)
break;
case EINPROGRESS:
case EAGAIN:
- dprintf("message not (tcp)send, would block\n");
+ dbgprintf("message not (tcp)send, would block\n");
# if USE_PTHREADS
usleep(1000); /* experimental - might be benefitial in this situation */
# endif
@@ -492,7 +492,7 @@ static int TCPSend(instanceData *pData, char *msg, size_t len)
return 0;
break;
default:
- dprintf("message not (tcp)send");
+ dbgprintf("message not (tcp)send");
break;
}
@@ -550,7 +550,7 @@ static rsRetVal doTryResume(instanceData *pData)
case eDestFORW_UNKN:
/* The remote address is not yet known and needs to be obtained */
- dprintf(" %s\n", pData->f_hname);
+ dbgprintf(" %s\n", pData->f_hname);
memset(&hints, 0, sizeof(hints));
/* port must be numeric, because config file syntax requests this */
/* TODO: this code is a duplicate from cfline() - we should later create
@@ -561,7 +561,7 @@ static rsRetVal doTryResume(instanceData *pData)
hints.ai_socktype = pData->protocol == FORW_UDP ? SOCK_DGRAM : SOCK_STREAM;
if((e = getaddrinfo(pData->f_hname,
getFwdSyslogPt(pData), &hints, &res)) == 0) {
- dprintf("%s found, resuming.\n", pData->f_hname);
+ dbgprintf("%s found, resuming.\n", pData->f_hname);
pData->f_addr = res;
pData->iRtryCnt = 0;
pData->eDestState = eDestFORW;
@@ -590,17 +590,17 @@ BEGINdoAction
CODESTARTdoAction
switch (pData->eDestState) {
case eDestFORW_SUSP:
- dprintf("internal error in omfwd.c, eDestFORW_SUSP in doAction()!\n");
+ dbgprintf("internal error in omfwd.c, eDestFORW_SUSP in doAction()!\n");
iRet = RS_RET_SUSPENDED;
break;
case eDestFORW_UNKN:
- dprintf("doAction eDestFORW_UNKN\n");
+ dbgprintf("doAction eDestFORW_UNKN\n");
iRet = doTryResume(pData);
break;
case eDestFORW:
- dprintf(" %s:%s/%s\n", pData->f_hname, getFwdSyslogPt(pData),
+ dbgprintf(" %s:%s/%s\n", pData->f_hname, getFwdSyslogPt(pData),
pData->protocol == FORW_UDP ? "udp" : "tcp");
if ( 0) // TODO: think about this strcmp(getHOSTNAME(f->f_pMsg), LocalHostName) && NoHops )
/* what we need to do is get the hostname as an additonal string (during parseSe..). Then,
@@ -611,7 +611,7 @@ CODESTARTdoAction
* handling things than to relay on the error-prone hostname property.
* rgerhards, 2007-07-27
*/
- dprintf("Not sending message to remote.\n");
+ dbgprintf("Not sending message to remote.\n");
else {
pData->ttSuspend = time(NULL);
psz = (char*) ppString[0];
@@ -635,7 +635,7 @@ CODESTARTdoAction
int ret;
ret = compress2((Bytef*) out+1, &destLen, (Bytef*) psz,
srcLen, pData->compressionLevel);
- dprintf("Compressing message, length was %d now %d, return state %d.\n",
+ dbgprintf("Compressing message, length was %d now %d, return state %d.\n",
l, (int) destLen, ret);
if(ret != Z_OK) {
/* if we fail, we complain, but only in debug mode
@@ -645,10 +645,10 @@ CODESTARTdoAction
* best course of action.
* rgerhards, 2006-11-30
*/
- dprintf("Compression failed, sending uncompressed message\n");
+ dbgprintf("Compression failed, sending uncompressed message\n");
} else if(destLen+1 < l) {
/* only use compression if there is a gain in using it! */
- dprintf("there is gain in compression, so we do it\n");
+ dbgprintf("there is gain in compression, so we do it\n");
psz = (char*) out;
l = destLen + 1; /* take care for the "z" at message start! */
}
@@ -677,7 +677,7 @@ CODESTARTdoAction
break;
} else {
int eno = errno;
- dprintf("sendto() error: %d = %s.\n",
+ dbgprintf("sendto() error: %d = %s.\n",
eno, strerror(eno));
}
}
@@ -686,7 +686,7 @@ CODESTARTdoAction
}
/* finished looping */
if (bSendSuccess == FALSE) {
- dprintf("error forwarding via udp, suspending\n");
+ dbgprintf("error forwarding via udp, suspending\n");
iRet = RS_RET_SUSPENDED;
}
}
@@ -694,7 +694,7 @@ CODESTARTdoAction
/* forward via TCP */
if(TCPSend(pData, psz, l) != 0) {
/* error! */
- dprintf("error forwarding via tcp, suspending\n");
+ dbgprintf("error forwarding via tcp, suspending\n");
iRet = RS_RET_SUSPENDED;
}
}
@@ -879,7 +879,7 @@ ENDneedUDPSocket
BEGINonSelectReadyWrite
CODESTARTonSelectReadyWrite
- dprintf("tcp send socket %d ready for writing.\n", pData->sock);
+ dbgprintf("tcp send socket %d ready for writing.\n", pData->sock);
TCPSendSetStatus(pData, TCP_SEND_READY);
/* Send stored message (if any) */
if(pData->savedMsg != NULL) {
diff --git a/ommysql.c b/ommysql.c
index 6a1040b5..43cd9ae1 100644
--- a/ommysql.c
+++ b/ommysql.c
@@ -131,7 +131,7 @@ static void reportDBError(instanceData *pData, int bSilent)
snprintf(errMsg, sizeof(errMsg)/sizeof(char), "db error (%d): %s\n", uMySQLErrno,
mysql_error(pData->f_hmysql));
if(bSilent || uMySQLErrno == pData->uLastMySQLErrno)
- dprintf("mysql, DBError(silent): %s\n", errMsg);
+ dbgprintf("mysql, DBError(silent): %s\n", errMsg);
else {
pData->uLastMySQLErrno = uMySQLErrno;
logerror(errMsg);
@@ -213,7 +213,7 @@ ENDtryResume
BEGINdoAction
CODESTARTdoAction
- dprintf("\n");
+ dbgprintf("\n");
iRet = writeMySQL(ppString[0], pData);
ENDdoAction
diff --git a/omshell.c b/omshell.c
index bc4ea56a..e9b72b42 100644
--- a/omshell.c
+++ b/omshell.c
@@ -85,7 +85,7 @@ CODESTARTdoAction
* modularization. We'll change that as we go ahead with modularization.
* rgerhards, 2007-07-20
*/
- dprintf("\n");
+ dbgprintf("\n");
if(execProg((uchar*) pData->progName, 1, ppString[0]) == 0)
logerrorSz("Executing program '%s' failed", (char*)pData->progName);
ENDdoAction
@@ -106,7 +106,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
switch (*p)
{
case '^': /* bkalkbrenner 2005-09-20: execute shell command */
- dprintf("exec\n");
+ dbgprintf("exec\n");
++p;
iRet = cflineParseFileName(p, (uchar*) pData->progName, *ppOMSR, 0, OMSR_NO_RQD_TPL_OPTS);
break;
diff --git a/omusrmsg.c b/omusrmsg.c
index d63f957a..736f325b 100644
--- a/omusrmsg.c
+++ b/omusrmsg.c
@@ -251,7 +251,7 @@ ENDtryResume
BEGINdoAction
CODESTARTdoAction
- dprintf("\n");
+ dbgprintf("\n");
iRet = wallmsg(ppString[0], pData);
ENDdoAction
@@ -271,7 +271,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
if(*p == '*') { /* wall */
- dprintf ("write-all");
+ dbgprintf("write-all");
++p; /* eat '*' */
pData->bIsWall = 1; /* write to all users */
if((iRet = cflineParseTemplateName(&p, *ppOMSR, 0, OMSR_NO_RQD_TPL_OPTS, (uchar*) " WallFmt"))
@@ -282,7 +282,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
* TODO: we must reconsider this - see also comment in
* loadBuildInModules() in syslogd.c
*/
- dprintf ("users: %s\n", p); /* ASP */
+ dbgprintf("users: %s\n", p); /* ASP */
pData->bIsWall = 0; /* write to individual users */
for (i = 0; i < MAXUNAMES && *p && *p != ';'; i++) {
for (q = p; *q && *q != ',' && *q != ';'; )
diff --git a/outchannel.c b/outchannel.c
index edadb740..13161a80 100644
--- a/outchannel.c
+++ b/outchannel.c
@@ -191,7 +191,7 @@ struct outchannel *ochAddLine(char* pName, uchar** ppRestOfConfLine)
pOch->iLenName = strlen(pName);
pOch->pszName = (char*) malloc(sizeof(char) * (pOch->iLenName + 1));
if(pOch->pszName == NULL) {
- dprintf("ochAddLine could not alloc memory for outchannel name!");
+ dbgprintf("ochAddLine could not alloc memory for outchannel name!");
pOch->iLenName = 0;
return NULL;
/* I know - we create a memory leak here - but I deem
@@ -248,7 +248,7 @@ void ochDeleteAll(void)
pOch = ochRoot;
while(pOch != NULL) {
- dprintf("Delete Outchannel: Name='%s'\n ", pOch->pszName == NULL? "NULL" : pOch->pszName);
+ dbgprintf("Delete Outchannel: Name='%s'\n ", pOch->pszName == NULL? "NULL" : pOch->pszName);
pOchDel = pOch;
pOch = pOch->pNext;
if(pOchDel->pszName != NULL)
@@ -267,10 +267,10 @@ void ochPrintList(void)
pOch = ochRoot;
while(pOch != NULL) {
- dprintf("Outchannel: Name='%s'\n", pOch->pszName == NULL? "NULL" : pOch->pszName);
- dprintf("\tFile Template: '%s'\n", pOch->pszFileTemplate == NULL ? "NULL" : pOch->pszFileTemplate);
- dprintf("\tMax Size.....: %lu\n", pOch->uSizeLimit);
- dprintf("\tOnSizeLimtCmd: '%s'\n", pOch->cmdOnSizeLimit == NULL ? "NULL" : pOch->cmdOnSizeLimit);
+ dbgprintf("Outchannel: Name='%s'\n", pOch->pszName == NULL? "NULL" : pOch->pszName);
+ dbgprintf("\tFile Template: '%s'\n", pOch->pszFileTemplate == NULL ? "NULL" : pOch->pszFileTemplate);
+ dbgprintf("\tMax Size.....: %lu\n", pOch->uSizeLimit);
+ dbgprintf("\tOnSizeLimtCmd: '%s'\n", pOch->cmdOnSizeLimit == NULL ? "NULL" : pOch->cmdOnSizeLimit);
pOch = pOch->pNext; /* done, go next */
}
}
diff --git a/srUtils.c b/srUtils.c
index 4e91bb9c..4834cfb3 100755
--- a/srUtils.c
+++ b/srUtils.c
@@ -174,7 +174,7 @@ int execProg(uchar *program, int bWait, uchar *arg)
int pid;
int sig;
- dprintf("exec program '%s' with param '%s'\n", program, arg);
+ dbgprintf("exec program '%s' with param '%s'\n", program, arg);
pid = fork();
if (pid < 0) {
return 0;
@@ -189,7 +189,7 @@ int execProg(uchar *program, int bWait, uchar *arg)
* loop. At some time, we may
* reconsider this behaviour.
*/
- dprintf("could not wait on child after executing '%s'",
+ dbgprintf("could not wait on child after executing '%s'",
(char*)program);
}
return pid;
diff --git a/syslogd.c b/syslogd.c
index 5f11f96d..d5714024 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -119,7 +119,7 @@
*
* I have removed syslogdPanic(). That function was supposed to be used
* for logging in low-memory conditons. Ever since it was introduced, it
- * was a wrapper for dprintf(). A more intelligent choice was hard to
+ * was a wrapper for dbgprintf(). A more intelligent choice was hard to
* find. After all, if we are short on memory, doing anything fance will
* again cause memory problems. I have now modified the code so that
* those elements for which we do not get memory are simply discarded.
@@ -979,7 +979,7 @@ static void PrintAllowedSenders(int iListToPrint)
* debug function, we simply spit out an error and do
* not care much about it.
*/
- dprintf("\tERROR in getnameinfo() - something may be wrong "
+ dbgprintf("\tERROR in getnameinfo() - something may be wrong "
"- ignored for now\n");
}
}
@@ -1002,7 +1002,7 @@ static inline int MaskCmp(struct NetAddr *pAllow, uint8_t bits, struct sockaddr
assert(pFrom != NULL);
if(F_ISSET(pAllow->flags, ADDR_NAME)) {
- dprintf ("MaskCmp: host=\"%s\"; pattern=\"%s\"\n", pszFromHost, pAllow->addr.HostWildcard);
+ dbgprintf("MaskCmp: host=\"%s\"; pattern=\"%s\"\n", pszFromHost, pAllow->addr.HostWildcard);
return(fnmatch(pAllow->addr.HostWildcard, pszFromHost, FNM_NOESCAPE|FNM_CASEFOLD) == 0);
} else {/* We need to compare an IP address */
@@ -1085,7 +1085,7 @@ int isAllowedSender(struct AllowedSenders *pAllowRoot, struct sockaddr *pFrom, c
if (MaskCmp (&(pAllow->allowedSender), pAllow->SignificantBits, pFrom, pszFromHost))
return 1;
}
- dprintf("%s is not an allowed sender\n", pszFromHost);
+ dbgprintf("%s is not an allowed sender\n", pszFromHost);
return 0;
}
#endif /* #ifdef SYSLOG_INET */
@@ -1105,7 +1105,7 @@ void freeAllSockets(int **socks)
assert(socks != NULL);
assert(*socks != NULL);
while(**socks) {
- dprintf("Closing socket %d.\n", (*socks)[**socks]);
+ dbgprintf("Closing socket %d.\n", (*socks)[**socks]);
close((*socks)[**socks]);
(**socks)--;
}
@@ -1657,7 +1657,7 @@ static int create_unix_socket(const char *path)
chmod(path, 0666) < 0) {
snprintf(line, sizeof(line), "cannot create %s", path);
logerror(line);
- dprintf("cannot create %s (%d).\n", path, errno);
+ dbgprintf("cannot create %s (%d).\n", path, errno);
close(fd);
return -1;
}
@@ -1813,7 +1813,7 @@ static int *create_udp_socket()
freeaddrinfo(res);
if(Debug && *socks != maxs)
- dprintf("We could initialize %d UDP listen sockets out of %d we received "
+ dbgprintf("We could initialize %d UDP listen sockets out of %d we received "
"- this may or may not be an error indication.\n", *socks, maxs);
if(*socks == 0) {
@@ -1934,7 +1934,7 @@ static char **crunch_list(char *list)
#if 0
count=0;
while (result[count])
- dprintf ("#%d: %s\n", count, StripDomains[count++]);
+ dbgprintf("#%d: %s\n", count, StripDomains[count++]);
#endif
return result;
}
@@ -1999,7 +1999,7 @@ void printchopped(char *hname, char *msg, int len, int fd, int bParseHost)
assert(msg != NULL);
assert(len >= 0);
- dprintf("Message length: %d, File descriptor: %d.\n", len, fd);
+ dbgprintf("Message length: %d, File descriptor: %d.\n", len, fd);
/* we first check if we need to drop trailing LFs, which often make
* their way into syslog messages unintentionally. In order to remain
@@ -2031,7 +2031,7 @@ void printchopped(char *hname, char *msg, int len, int fd, int bParseHost)
int ret;
iLenDefBuf = MAXLINE;
ret = uncompress((uchar *) deflateBuf, &iLenDefBuf, (uchar *) msg+1, len-1);
- dprintf("Compressed message uncompressed with status %d, length: new %d, old %d.\n",
+ dbgprintf("Compressed message uncompressed with status %d, length: new %d, old %d.\n",
ret, iLenDefBuf, len-1);
/* Now check if the uncompression worked. If not, there is not much we can do. In
* that case, we log an error message but ignore the message itself. Storing the
@@ -2142,7 +2142,7 @@ void printline(char *hname, char *msg, int bParseHost)
* message but continue to run (in the hope that things improve)
*/
glblHadMemShortage = 1;
- dprintf("Memory shortage in printline(): Could not construct Msg object.\n");
+ dbgprintf("Memory shortage in printline(): Could not construct Msg object.\n");
return;
}
MsgSetRawMsg(pMsg, msg);
@@ -2224,7 +2224,7 @@ static void logmsgInternal(int pri, char *msg, int flags)
* to be logged message.
*/
glblHadMemShortage = 1;
- dprintf("Memory shortage in logmsgInternal: could not construct Msg object.\n");
+ dbgprintf("Memory shortage in logmsgInternal: could not construct Msg object.\n");
return;
}
@@ -2282,14 +2282,14 @@ int shouldProcessThisMessage(selector_t *f, msg_t *pMsg)
} else if(f->eHostnameCmpMode == HN_COMP_MATCH) {
if(rsCStrSzStrCmp(f->pCSHostnameComp, (uchar*) getHOSTNAME(pMsg), getHOSTNAMELen(pMsg))) {
/* not equal, so we are already done... */
- dprintf("hostname filter '+%s' does not match '%s'\n",
+ dbgprintf("hostname filter '+%s' does not match '%s'\n",
rsCStrGetSzStr(f->pCSHostnameComp), getHOSTNAME(pMsg));
return 0;
}
} else { /* must be -hostname */
if(!rsCStrSzStrCmp(f->pCSHostnameComp, (uchar*) getHOSTNAME(pMsg), getHOSTNAMELen(pMsg))) {
/* not equal, so we are already done... */
- dprintf("hostname filter '-%s' does not match '%s'\n",
+ dbgprintf("hostname filter '-%s' does not match '%s'\n",
rsCStrGetSzStr(f->pCSHostnameComp), getHOSTNAME(pMsg));
return 0;
}
@@ -2298,7 +2298,7 @@ int shouldProcessThisMessage(selector_t *f, msg_t *pMsg)
if(f->pCSProgNameComp != NULL) {
if(rsCStrSzStrCmp(f->pCSProgNameComp, (uchar*) getProgramName(pMsg), getProgramNameLen(pMsg))) {
/* not equal, so we are already done... */
- dprintf("programname filter '%s' does not match '%s'\n",
+ dbgprintf("programname filter '%s' does not match '%s'\n",
rsCStrGetSzStr(f->pCSProgNameComp), getProgramName(pMsg));
return 0;
}
@@ -2434,7 +2434,7 @@ static rsRetVal callAction(msg_t *pMsg, action_t *pAction)
!strcmp(getMSG(pMsg), getMSG(pAction->f_pMsg)) &&
!strcmp(getHOSTNAME(pMsg), getHOSTNAME(pAction->f_pMsg))) {
pAction->f_prevcount++;
- dprintf("msg repeated %d times, %ld sec of %d.\n",
+ dbgprintf("msg repeated %d times, %ld sec of %d.\n",
pAction->f_prevcount, now - pAction->f_time,
repeatinterval[pAction->f_repeatcount]);
/* If domark would have logged this by now, flush it now (so we don't hold
@@ -2485,7 +2485,7 @@ DEFFUNC_llExecFunc(processMsgDoActions)
assert(pAction != NULL);
if((pAction->bExecWhenPrevSusp == 1) && (pDoActData->bPrevWasSuspended == 0)) {
- dprintf("not calling action because the previous one is not suspended\n");
+ dbgprintf("not calling action because the previous one is not suspended\n");
ABORT_FINALIZE(RS_RET_OK);
}
@@ -2569,7 +2569,7 @@ static void stopWorker(void)
* during startup. Then, we obviously do not need to
* do anything to stop the worker ;)
*/
- dprintf("Initiating worker thread shutdown sequence...\n");
+ dbgprintf("Initiating worker thread shutdown sequence...\n");
/* We are now done with all messages, so we need to wake up the
* worker thread and then wait for it to finish.
*/
@@ -2580,7 +2580,7 @@ static void stopWorker(void)
pthread_cond_signal(pMsgQueue->notEmpty);
pthread_join(thrdWorker, NULL);
bRunningMultithreaded = 0;
- dprintf("Worker thread terminated.\n");
+ dbgprintf("Worker thread terminated.\n");
}
}
@@ -2595,10 +2595,10 @@ static void startWorker(void)
if(pMsgQueue != NULL) {
bGlblDone = 0; /* we are NOT done (else worker would immediately terminate) */
i = pthread_create(&thrdWorker, NULL, singleWorker, NULL);
- dprintf("Worker thread started with state %d.\n", i);
+ dbgprintf("Worker thread started with state %d.\n", i);
bRunningMultithreaded = 1;
} else {
- dprintf("message queue not existing, remaining single-threaded.\n");
+ dbgprintf("message queue not existing, remaining single-threaded.\n");
}
}
@@ -2682,7 +2682,7 @@ static void *singleWorker()
while(!bGlblDone || !fifo->empty) {
pthread_mutex_lock(fifo->mut);
while (fifo->empty && !bGlblDone) {
- dprintf ("singleWorker: queue EMPTY, waiting for next message.\n");
+ dbgprintf("singleWorker: queue EMPTY, waiting for next message.\n");
pthread_cond_wait (fifo->notEmpty, fifo->mut);
}
if(!fifo->empty) {
@@ -2692,7 +2692,7 @@ static void *singleWorker()
pthread_mutex_unlock(fifo->mut);
pthread_cond_signal (fifo->notFull);
/* do actual processing (the lengthy part, runs in parallel) */
- dprintf("Lone worker is running...\n");
+ dbgprintf("Lone worker is running...\n");
processMsg(pMsg);
MsgDestruct(pMsg);
/* If you need a delay for testing, here do a */
@@ -2702,10 +2702,10 @@ static void *singleWorker()
}
if(debugging_on && bGlblDone && !fifo->empty)
- dprintf("Worker does not yet terminate because it still has messages to process.\n");
+ dbgprintf("Worker does not yet terminate because it still has messages to process.\n");
}
- dprintf("Worker thread terminates\n");
+ dbgprintf("Worker thread terminates\n");
pthread_exit(0);
}
@@ -2735,21 +2735,21 @@ static void enqueueMsg(msg_t *pMsg)
/* multi-threading is not yet initialized, happens e.g.
* during startup and restart. rgerhards, 2005-10-25
*/
- dprintf("enqueueMsg: not yet running on multiple threads\n");
+ dbgprintf("enqueueMsg: not yet running on multiple threads\n");
processMsg(pMsg);
} else {
/* "normal" mode, threading initialized */
pthread_mutex_lock(fifo->mut);
while (fifo->full) {
- dprintf ("enqueueMsg: queue FULL.\n");
+ dbgprintf("enqueueMsg: queue FULL.\n");
clock_gettime (CLOCK_REALTIME, &t);
t.tv_sec += 2;
if(pthread_cond_timedwait (fifo->notFull,
fifo->mut, &t) != 0) {
- dprintf("enqueueMsg: cond timeout, dropping message!\n");
+ dbgprintf("enqueueMsg: cond timeout, dropping message!\n");
goto unlock;
}
}
@@ -2758,7 +2758,7 @@ static void enqueueMsg(msg_t *pMsg)
/* now activate the worker thread */
pthread_mutex_unlock(fifo->mut);
iRet = pthread_cond_signal(fifo->notEmpty);
- dprintf("EnqueueMsg signaled condition (%d)\n", iRet);
+ dbgprintf("EnqueueMsg signaled condition (%d)\n", iRet);
}
}
#endif /* #ifndef USE_PTHREADS */
@@ -2909,7 +2909,7 @@ static int parseRFCSyslogMsg(msg_t *pMsg, int flags)
/* TIMESTAMP */
if(srSLMGParseTIMESTAMP3339(&(pMsg->tTIMESTAMP), &p2parse) == FALSE) {
- dprintf("no TIMESTAMP detected!\n");
+ dbgprintf("no TIMESTAMP detected!\n");
bContParse = 0;
flags |= ADDDATE;
}
@@ -3051,7 +3051,7 @@ static int parseLegacySyslogMsg(msg_t *pMsg, int flags)
/* indeed, this smells like a TAG, so lets use it for this. We take
* the HOSTNAME from the sender system instead.
*/
- dprintf("HOSTNAME contains invalid characters, assuming it to be a TAG.\n");
+ dbgprintf("HOSTNAME contains invalid characters, assuming it to be a TAG.\n");
moveHOSTNAMEtoTAG(pMsg);
MsgSetHOSTNAME(pMsg, getRcvFrom(pMsg));
}
@@ -3099,7 +3099,7 @@ static int parseLegacySyslogMsg(msg_t *pMsg, int flags)
* the hostname. This situation is the standard case with
* stock BSD syslogd.
*/
- dprintf("No TAG in message, assuming that HOSTNAME is missing.\n");
+ dbgprintf("No TAG in message, assuming that HOSTNAME is missing.\n");
moveHOSTNAMEtoTAG(pMsg);
MsgSetHOSTNAME(pMsg, getRcvFrom(pMsg));
}
@@ -3117,7 +3117,7 @@ static int parseLegacySyslogMsg(msg_t *pMsg, int flags)
*/
if(!(flags & INTERNAL_MSG))
{
- dprintf("HOSTNAME and TAG not parsed by user configuraton.\n");
+ dbgprintf("HOSTNAME and TAG not parsed by user configuraton.\n");
MsgSetHOSTNAME(pMsg, getRcvFrom(pMsg));
}
}
@@ -3156,7 +3156,7 @@ void logmsg(int pri, msg_t *pMsg, int flags)
assert(pMsg != NULL);
assert(pMsg->pszUxTradMsg != NULL);
msg = (char*) pMsg->pszUxTradMsg;
- dprintf("logmsg: %s, flags %x, from '%s', msg %s\n",
+ dbgprintf("logmsg: %s, flags %x, from '%s', msg %s\n",
textpri(PRItext, sizeof(PRItext) / sizeof(char), pri),
flags, getRcvFrom(pMsg), msg);
@@ -3166,12 +3166,12 @@ void logmsg(int pri, msg_t *pMsg, int flags)
* -protocol VERSION field for the detection.
*/
if(msg[0] == '1' && msg[1] == ' ') {
- dprintf("Message has syslog-protocol format.\n");
+ dbgprintf("Message has syslog-protocol format.\n");
setProtocolVersion(pMsg, 1);
if(parseRFCSyslogMsg(pMsg, flags) == 1)
return;
} else { /* we have legacy syslog */
- dprintf("Message has legacy syslog format.\n");
+ dbgprintf("Message has legacy syslog format.\n");
setProtocolVersion(pMsg, 0);
if(parseLegacySyslogMsg(pMsg, flags) == 1)
return;
@@ -3253,7 +3253,7 @@ rsRetVal fprintlog(action_t *pAction)
if((pMsg = MsgDup(pAction->f_pMsg)) == NULL) {
/* it failed - nothing we can do against it... */
- dprintf("Message duplication failed, dropping repeat message.\n");
+ dbgprintf("Message duplication failed, dropping repeat message.\n");
return RS_RET_ERR;
}
@@ -3270,7 +3270,7 @@ rsRetVal fprintlog(action_t *pAction)
pAction->f_pMsg = pMsg; /* use the new msg (pointer will be restored below) */
}
- dprintf("Called fprintlog, logging to %s", modGetStateName(pAction->pMod));
+ dbgprintf("Called fprintlog, logging to %s", modGetStateName(pAction->pMod));
pAction->f_time = now; /* we need this for message repeation processing TODO: why must "now" be global? */
@@ -3281,7 +3281,7 @@ rsRetVal fprintlog(action_t *pAction)
for(i = 0 ; i < pAction->iNumTpls ; ++i) {
if((pAction->ppMsgs[i] = tplToString(pAction->ppTpl[i], pAction->f_pMsg)) == NULL) {
- dprintf("memory alloc failed while generating message strings - message ignored\n");
+ dbgprintf("memory alloc failed while generating message strings - message ignored\n");
glblHadMemShortage = 1;
iRet = RS_RET_OUT_OF_MEMORY;
goto finalize_it;
@@ -3291,12 +3291,12 @@ rsRetVal fprintlog(action_t *pAction)
iRet = pAction->pMod->mod.om.doAction(pAction->ppMsgs, pAction->f_pMsg->msgFlags, pAction->pModData);
if(iRet == RS_RET_DISABLE_ACTION) {
- dprintf("Action requested to be disabled, done that.\n");
+ dbgprintf("Action requested to be disabled, done that.\n");
pAction->bEnabled = 0; /* that's it... */
}
if(iRet == RS_RET_SUSPENDED) {
- dprintf("Action requested to be suspended, done that.\n");
+ dbgprintf("Action requested to be suspended, done that.\n");
actionSuspend(pAction);
}
@@ -3349,7 +3349,7 @@ DEFFUNC_llExecFunc(domarkActions)
assert(pAction != NULL);
if (pAction->f_prevcount && now >= REPEATTIME(pAction)) {
- dprintf("flush %s: repeated %d times, %d sec.\n",
+ dbgprintf("flush %s: repeated %d times, %d sec.\n",
modGetStateName(pAction->pMod), pAction->f_prevcount,
repeatinterval[pAction->f_repeatcount]);
fprintlog(pAction);
@@ -3408,7 +3408,7 @@ static void domarkAlarmHdlr()
static void debug_switch()
{
- dprintf("Switching debugging_on to %s\n", (debugging_on == 0) ? "true" : "false");
+ dbgprintf("Switching debugging_on to %s\n", (debugging_on == 0) ? "true" : "false");
debugging_on = (debugging_on == 0) ? 1 : 0;
signal(SIGUSR1, debug_switch);
}
@@ -3452,7 +3452,7 @@ void logerror(char *type)
{
char buf[1024];
- dprintf("Called logerr, msg: %s\n", type);
+ dbgprintf("Called logerr, msg: %s\n", type);
if (errno == 0)
snprintf(buf, sizeof(buf), "%s", type);
@@ -3474,7 +3474,7 @@ void logerror(char *type)
*/
static void doDie(int sig)
{
- dprintf("DoDie called.\n");
+ dbgprintf("DoDie called.\n");
bFinished = sig;
}
@@ -3494,7 +3494,7 @@ static void die(int sig)
int i;
if (sig) {
- dprintf(" exiting on signal %d\n", sig);
+ dbgprintf(" exiting on signal %d\n", sig);
(void) snprintf(buf, sizeof(buf) / sizeof(char),
" [origin software=\"rsyslogd\" " "swVersion=\"" VERSION \
"\" x-pid=\"%d\"]" " exiting on signal %d.",
@@ -3541,8 +3541,8 @@ static void die(int sig)
remove_pid(PidFile);
if(glblHadMemShortage)
- dprintf("Had memory shortage at least once during the run.\n");
- dprintf("Clean shutdown completed, bye.\n");
+ dbgprintf("Had memory shortage at least once during the run.\n");
+ dbgprintf("Clean shutdown completed, bye.\n");
exit(0); /* "good" exit, this is the terminator function for rsyslog [die()] */
}
@@ -3677,7 +3677,7 @@ static rsRetVal doIncludeDirectory(uchar *pDirName)
iFileNameLen = strnlen(res->d_name, NAME_MAX);
memcpy(szFullFileName + iDirNameLen, res->d_name, iFileNameLen);
*(szFullFileName + iDirNameLen + iFileNameLen) = '\0';
- dprintf("including file '%s'\n", szFullFileName);
+ dbgprintf("including file '%s'\n", szFullFileName);
processConfFile(szFullFileName);
/* we deliberately ignore the iRet of processConfFile() - this is because
* failure to process one file does not mean all files will fail. By ignoring,
@@ -3691,7 +3691,7 @@ static rsRetVal doIncludeDirectory(uchar *pDirName)
* into the config file just in case, when additional modules be installed. When none
* are installed, the directory will be empty, which is fine. -- rgerhards 2007-08-01
*/
- dprintf("warning: the include directory contained no files - this may be ok.\n");
+ dbgprintf("warning: the include directory contained no files - this may be ok.\n");
}
finalize_it:
@@ -3720,10 +3720,10 @@ static rsRetVal doIncludeLine(uchar **pp, __attribute__((unused)) void* pVal)
}
if(*(cfgFile+strlen((char*) cfgFile) - 1) == '/') {
- dprintf("requested to include directory '%s'\n", cfgFile);
+ dbgprintf("requested to include directory '%s'\n", cfgFile);
iRet = doIncludeDirectory(cfgFile);
} else {
- dprintf("Requested to include config file '%s'\n", cfgFile);
+ dbgprintf("Requested to include config file '%s'\n", cfgFile);
iRet = processConfFile(cfgFile);
}
@@ -3750,7 +3750,7 @@ static rsRetVal doModLoad(uchar **pp, __attribute__((unused)) void* pVal)
ABORT_FINALIZE(RS_RET_NOT_FOUND);
}
- dprintf("Requested to load module '%s'\n", szName);
+ dbgprintf("Requested to load module '%s'\n", szName);
if(!strcmp((char*)szName, "MySQL")) {
bModMySQLLoaded = 1;
@@ -3814,7 +3814,7 @@ static rsRetVal doNameLine(uchar **pp, void* pVal)
* is quite ok (but then we should not run into this code,
* so at least we log a debug warning).
*/
- dprintf("INTERNAL ERROR: doNameLine() called with invalid eDir %d.\n",
+ dbgprintf("INTERNAL ERROR: doNameLine() called with invalid eDir %d.\n",
eDir);
break;
}
@@ -3831,7 +3831,7 @@ finalize_it:
static rsRetVal setUmask(void __attribute__((unused)) *pVal, int iUmask)
{
umask(iUmask);
- dprintf("umask set to 0%3.3o.\n", iUmask);
+ dbgprintf("umask set to 0%3.3o.\n", iUmask);
return RS_RET_OK;
}
@@ -3906,7 +3906,7 @@ static void freeSelectors(void)
selector_t *fPrev;
if(Files != NULL) {
- dprintf("Freeing log structures.\n");
+ dbgprintf("Freeing log structures.\n");
/* just in case, we flush the emergency log. If error messages occur after
* this stage, we loose them, but that's ok. With multi-threading, this can
@@ -4104,7 +4104,7 @@ static rsRetVal processConfFile(uchar *pConfFile)
* line can be correct. -- rgerhards, 2007-08-02
*/
uchar szErrLoc[MAXFNAME + 64];
- dprintf("config line NOT successfully processed\n");
+ dbgprintf("config line NOT successfully processed\n");
snprintf((char*)szErrLoc, sizeof(szErrLoc) / sizeof(uchar),
"%s, line %d", pConfFile, iLnNbr);
logerrorSz("the last error occured in %s", (char*)szErrLoc);
@@ -4121,7 +4121,7 @@ finalize_it:
if(iRet != RS_RET_OK) {
if(fCurr != NULL)
selectorDestruct(fCurr);
- dprintf("error %d processing config file '%s'; os error (if any): %s\n",
+ dbgprintf("error %d processing config file '%s'; os error (if any): %s\n",
iRet, pConfFile, strerror(errno));
}
return iRet;
@@ -4194,17 +4194,17 @@ static void init(void)
}
}
- dprintf("Called init.\n");
+ dbgprintf("Called init.\n");
/* Close all open log files and free log descriptor array. */
freeSelectors();
- dprintf("Clearing templates.\n");
+ dbgprintf("Clearing templates.\n");
tplDeleteNew();
#ifdef USE_PTHREADS
if(pMsgQueue != NULL) {
- dprintf("deleting message queue\n");
+ dbgprintf("deleting message queue\n");
queueDelete(pMsgQueue); /* delete fifo here! */
pMsgQueue = NULL;
}
@@ -4231,7 +4231,7 @@ static void init(void)
*/
selector_t *f = NULL;
char *pTTY = ttyname(0);
- dprintf("primary config file could not be opened - using emergency definitions.\n");
+ dbgprintf("primary config file could not be opened - using emergency definitions.\n");
cfline((uchar*)"*.ERR\t" _PATH_CONSOLE, &f);
cfline((uchar*)"*.PANIC\t*", &f);
if(pTTY != NULL) {
@@ -4262,7 +4262,7 @@ static void init(void)
*/
continue;
if ((funix[i] = create_unix_socket(funixn[i])) != -1)
- dprintf("Opened UNIX socket `%s' (fd %d).\n", funixn[i], funix[i]);
+ dbgprintf("Opened UNIX socket `%s' (fd %d).\n", funixn[i], funix[i]);
}
#endif
@@ -4276,7 +4276,7 @@ static void init(void)
if(Forwarding || AcceptRemote) {
if (finet == NULL) {
if((finet = create_udp_socket()) != NULL)
- dprintf("Opened %d syslog UDP port(s).\n", *finet);
+ dbgprintf("Opened %d syslog UDP port(s).\n", *finet);
}
}
else {
@@ -4293,7 +4293,7 @@ static void init(void)
* user-selectable option. rgerhards, 2007-06-21
*/
if((sockTCPLstn = create_tcp_socket()) != NULL) {
- dprintf("Opened %d syslog TCP port(s).\n", *sockTCPLstn);
+ dbgprintf("Opened %d syslog TCP port(s).\n", *sockTCPLstn);
}
}
}
@@ -4335,7 +4335,7 @@ static void init(void)
logmsgInternal(LOG_SYSLOG|LOG_INFO, bufStartUpMsg, ADDDATE);
(void) signal(SIGHUP, sighup_handler);
- dprintf(" restarted.\n");
+ dbgprintf(" restarted.\n");
}
@@ -4455,7 +4455,7 @@ static rsRetVal cflineProcessTradPRIFilter(uchar **pline, register selector_t *f
assert(*pline != NULL);
assert(f != NULL);
- dprintf(" - traditional PRI filter\n");
+ dbgprintf(" - traditional PRI filter\n");
errno = 0; /* keep strerror() stuff out of logerror messages */
f->f_filter_type = FILTER_PRI;
@@ -4614,7 +4614,7 @@ static rsRetVal cflineProcessPropFilter(uchar **pline, register selector_t *f)
assert(*pline != NULL);
assert(f != NULL);
- dprintf(" - property-based filter\n");
+ dbgprintf(" - property-based filter\n");
errno = 0; /* keep strerror() stuff out of logerror messages */
f->f_filter_type = FILTER_PROP;
@@ -4709,7 +4709,7 @@ static rsRetVal cflineProcessHostSelector(uchar **pline)
assert(*pline != NULL);
assert(**pline == '-' || **pline == '+');
- dprintf(" - host selector line\n");
+ dbgprintf(" - host selector line\n");
/* check include/exclude setting */
if(**pline == '+') {
@@ -4726,7 +4726,7 @@ static rsRetVal cflineProcessHostSelector(uchar **pline)
* Order of conditions in the if-statement is vital! rgerhards 2005-10-18
*/
if(**pline != '\0' && **pline == '*' && *(*pline+1) == '\0') {
- dprintf("resetting BSD-like hostname filter\n");
+ dbgprintf("resetting BSD-like hostname filter\n");
eDfltHostnameCmpMode = HN_NO_COMP;
if(pDfltHostnameCmp != NULL) {
if((iRet = rsCStrSetSzStr(pDfltHostnameCmp, NULL)) != RS_RET_OK)
@@ -4734,7 +4734,7 @@ static rsRetVal cflineProcessHostSelector(uchar **pline)
pDfltHostnameCmp = NULL;
}
} else {
- dprintf("setting BSD-like hostname filter to '%s'\n", *pline);
+ dbgprintf("setting BSD-like hostname filter to '%s'\n", *pline);
if(pDfltHostnameCmp == NULL) {
/* create string for parser */
if((iRet = rsCStrConstructFromszStr(&pDfltHostnameCmp, *pline)) != RS_RET_OK)
@@ -4761,7 +4761,7 @@ static rsRetVal cflineProcessTagSelector(uchar **pline)
assert(*pline != NULL);
assert(**pline == '!');
- dprintf(" - programname selector line\n");
+ dbgprintf(" - programname selector line\n");
(*pline)++; /* eat '!' */
@@ -4772,14 +4772,14 @@ static rsRetVal cflineProcessTagSelector(uchar **pline)
* Order of conditions in the if-statement is vital! rgerhards 2005-10-18
*/
if(**pline != '\0' && **pline == '*' && *(*pline+1) == '\0') {
- dprintf("resetting programname filter\n");
+ dbgprintf("resetting programname filter\n");
if(pDfltProgNameCmp != NULL) {
if((iRet = rsCStrSetSzStr(pDfltProgNameCmp, NULL)) != RS_RET_OK)
return(iRet);
pDfltProgNameCmp = NULL;
}
} else {
- dprintf("setting programname filter to '%s'\n", *pline);
+ dbgprintf("setting programname filter to '%s'\n", *pline);
if(pDfltProgNameCmp == NULL) {
/* create string for parser */
if((iRet = rsCStrConstructFromszStr(&pDfltProgNameCmp, *pline)) != RS_RET_OK)
@@ -4810,7 +4810,7 @@ rsRetVal addAction(action_t **ppAction, modInfo_t *pMod, void *pModData, omodStr
assert(ppAction != NULL);
assert(pMod != NULL);
assert(pOMSR != NULL);
- dprintf("Module %s processed this config line.\n", modGetName(pMod));
+ dbgprintf("Module %s processed this config line.\n", modGetName(pMod));
CHKiRet(actionConstruct(&pAction)); /* create action object first */
pAction->pMod = pMod;
@@ -4864,7 +4864,7 @@ rsRetVal addAction(action_t **ppAction, modInfo_t *pMod, void *pModData, omodStr
goto finalize_it;
}
- dprintf("template: '%s' assgined\n", pTplName);
+ dbgprintf("template: '%s' assgined\n", pTplName);
}
pAction->pMod = pMod;
@@ -4873,7 +4873,7 @@ rsRetVal addAction(action_t **ppAction, modInfo_t *pMod, void *pModData, omodStr
if(pMod->isCompatibleWithFeature(sFEATURERepeatedMsgReduction) == RS_RET_OK)
pAction->f_ReduceRepeated = bReduceRepeatMsgs;
else {
- dprintf("module is incompatible with RepeatedMsgReduction - turned off\n");
+ dbgprintf("module is incompatible with RepeatedMsgReduction - turned off\n");
pAction->f_ReduceRepeated = 0;
}
pAction->bEnabled = 1; /* action is enabled */
@@ -4953,14 +4953,14 @@ static rsRetVal cflineDoAction(uchar **p, action_t **ppAction)
pMod = omodGetNxt(NULL);
while(pMod != NULL) {
iRet = pMod->mod.om.parseSelectorAct(p, &pModData, &pOMSR);
- dprintf("tried selector action for %s: %d\n", modGetName(pMod), iRet);
+ dbgprintf("tried selector action for %s: %d\n", modGetName(pMod), iRet);
if(iRet == RS_RET_OK || iRet == RS_RET_SUSPENDED) {
if((iRet = addAction(&pAction, pMod, pModData, pOMSR, (iRet == RS_RET_SUSPENDED)? 1 : 0)) == RS_RET_OK) {
/* now check if the module is compatible with select features */
if(pMod->isCompatibleWithFeature(sFEATURERepeatedMsgReduction) == RS_RET_OK)
pAction->f_ReduceRepeated = bReduceRepeatMsgs;
else {
- dprintf("module is incompatible with RepeatedMsgReduction - turned off\n");
+ dbgprintf("module is incompatible with RepeatedMsgReduction - turned off\n");
pAction->f_ReduceRepeated = 0;
}
pAction->bEnabled = 1; /* action is enabled */
@@ -4974,7 +4974,7 @@ static rsRetVal cflineDoAction(uchar **p, action_t **ppAction)
* modules on this line, because we found the right one.
* rgerhards, 2007-07-24
*/
- dprintf("error %d parsing config line\n", (int) iRet);
+ dbgprintf("error %d parsing config line\n", (int) iRet);
break;
}
pMod = omodGetNxt(pMod);
@@ -5049,7 +5049,7 @@ static rsRetVal selectorAddList(selector_t *f)
goto finalize_it;
}
/* successfully created an entry */
- dprintf("selector line successfully processed\n");
+ dbgprintf("selector line successfully processed\n");
/* TODO: we should use the linked list class for the selector list, else we need to add globals
* ... well nextp could be added temporarily...
* Thanks to varmojfekoj for having the idea to just use "Files" to make this
@@ -5123,7 +5123,7 @@ static rsRetVal cfline(uchar *line, selector_t **pfCurr)
assert(line != NULL);
- dprintf("cfline: '%s'\n", line);
+ dbgprintf("cfline: '%s'\n", line);
/* check type of line and call respective processing */
switch(*line) {
@@ -5158,10 +5158,10 @@ int decode(uchar *name, struct code *codetab)
assert(name != NULL);
assert(codetab != NULL);
- dprintf ("symbolic name: %s", name);
+ dbgprintf("symbolic name: %s", name);
if (isdigit((int) *name))
{
- dprintf ("\n");
+ dbgprintf("\n");
return (atoi((char*) name));
}
strncpy((char*) buf, (char*) name, 79);
@@ -5171,14 +5171,14 @@ int decode(uchar *name, struct code *codetab)
for (c = codetab; c->c_name; c++)
if (!strcmp((char*) buf, (char*) c->c_name))
{
- dprintf (" ==> %d\n", c->c_val);
+ dbgprintf(" ==> %d\n", c->c_val);
return (c->c_val);
}
return (-1);
}
-extern void dprintf(char *fmt, ...) __attribute__((format(printf,1, 2)));
-void dprintf(char *fmt, ...)
+extern void dbgprintf(char *fmt, ...) __attribute__((format(printf,1, 2)));
+void dbgprintf(char *fmt, ...)
{
# ifdef USE_PTHREADS
static int bWasNL = FALSE;
@@ -5254,7 +5254,7 @@ int getSubString(uchar **ppSrc, char *pDst, size_t DstSize, char cSep)
/* check if the Dst buffer was to small */
if (*pSrc != cSep && *pSrc != '\n' && *pSrc != '\0')
{
- dprintf("in getSubString, error Src buffer > Dst buffer\n");
+ dbgprintf("in getSubString, error Src buffer > Dst buffer\n");
iErr = 1;
}
if (*pSrc == '\0' || *pSrc == '\n')
@@ -5298,7 +5298,7 @@ static void debugListenInfo(int fd, char *type)
port = -1;
break;
}
- dprintf("Listening on %s syslogd socket %d (%s/port %d).\n",
+ dbgprintf("Listening on %s syslogd socket %d (%s/port %d).\n",
type, fd, szFamily, port);
return;
}
@@ -5307,7 +5307,7 @@ static void debugListenInfo(int fd, char *type)
* debug info, so this is no reason to break the program
* or do any serious error reporting.
*/
- dprintf("Listening on syslogd socket %d - could not obtain peer info.\n", fd);
+ dbgprintf("Listening on syslogd socket %d - could not obtain peer info.\n", fd);
}
@@ -5378,7 +5378,7 @@ DEFFUNC_llExecFunc(mainloopCallWithWritableFDsActions)
if(FD_ISSET(fdMod, pState->pWritefds)) {
if((iRet = pAction->pMod->onSelectReadyWrite(pAction->pModData))
!= RS_RET_OK) {
- dprintf("error %d from onSelectReadyWrite() - continuing\n", iRet);
+ dbgprintf("error %d from onSelectReadyWrite() - continuing\n", iRet);
}
if(--(pState->pMaxfds) == 0) {
ABORT_FINALIZE(RS_RET_FINISHED); /* all processed, nothing left to do */
@@ -5417,21 +5417,21 @@ static rsRetVal processSelectAfter(int maxfds, int nfds, fd_set *pReadfds, fd_se
/* the following macro is used to decrement the number of to-be-probed
* fds and abort this function when we are done with all.
*/
-# define FDPROCESSED() if(--nfds == 0) { dprintf("nfds == 0, aborting\n");ABORT_FINALIZE(RS_RET_OK); }
+# define FDPROCESSED() if(--nfds == 0) { dbgprintf("nfds == 0, aborting\n");ABORT_FINALIZE(RS_RET_OK); }
if (nfds < 0) {
if (errno != EINTR)
logerror("select");
- dprintf("Select interrupted.\n");
+ dbgprintf("Select interrupted.\n");
ABORT_FINALIZE(RS_RET_OK); /* we are done in any case */
}
if(debugging_on) {
- dprintf("\nSuccessful select, descriptor count = %d, Activity on: ", nfds);
+ dbgprintf("\nSuccessful select, descriptor count = %d, Activity on: ", nfds);
for (i = 0; i <= maxfds; ++i)
if ( FD_ISSET(i, pReadfds) )
- dprintf("%d ", i);
- dprintf(("\n"));
+ dbgprintf("%d ", i);
+ dbgprintf(("\n"));
}
#ifdef SYSLOG_INET
@@ -5463,11 +5463,11 @@ static rsRetVal processSelectAfter(int maxfds, int nfds, fd_set *pReadfds, fd_se
if ((fd = funix[i]) != -1 && FD_ISSET(fd, pReadfds)) {
int iRcvd;
iRcvd = recv(fd, line, MAXLINE - 1, 0);
- dprintf("Message from UNIX socket: #%d\n", fd);
+ dbgprintf("Message from UNIX socket: #%d\n", fd);
if (iRcvd > 0) {
printchopped(LocalHostName, line, iRcvd, fd, funixParseHost[i]);
} else if (iRcvd < 0 && errno != EINTR) {
- dprintf("UNIX socket error: %d = %s.\n", \
+ dbgprintf("UNIX socket error: %d = %s.\n", \
errno, strerror(errno));
logerror("recvfrom UNIX");
}
@@ -5487,7 +5487,7 @@ static rsRetVal processSelectAfter(int maxfds, int nfds, fd_set *pReadfds, fd_se
if (l > 0) {
line[l] = '\0';
if(cvthname(&frominet, fromHost, fromHostFQDN) == 1) {
- dprintf("Message from inetd socket: #%d, host: %s\n",
+ dbgprintf("Message from inetd socket: #%d, host: %s\n",
finet[i+1], fromHost);
/* Here we check if a host is permitted to send us
* syslog messages. If it isn't, we do not further
@@ -5507,7 +5507,7 @@ static rsRetVal processSelectAfter(int maxfds, int nfds, fd_set *pReadfds, fd_se
}
}
else if (l < 0 && errno != EINTR && errno != EAGAIN) {
- dprintf("INET socket error: %d = %s.\n",
+ dbgprintf("INET socket error: %d = %s.\n",
errno, strerror(errno));
logerror("recvfrom inet");
/* should be harmless */
@@ -5521,7 +5521,7 @@ static rsRetVal processSelectAfter(int maxfds, int nfds, fd_set *pReadfds, fd_se
if(sockTCPLstn != NULL && *sockTCPLstn) {
for (i = 0; i < *sockTCPLstn; i++) {
if (FD_ISSET(sockTCPLstn[i+1], pReadfds)) {
- dprintf("New connect on TCP inetd socket: #%d\n", sockTCPLstn[i+1]);
+ dbgprintf("New connect on TCP inetd socket: #%d\n", sockTCPLstn[i+1]);
TCPSessAccept(sockTCPLstn[i+1]);
FDPROCESSED();
}
@@ -5535,7 +5535,7 @@ static rsRetVal processSelectAfter(int maxfds, int nfds, fd_set *pReadfds, fd_se
fdSess = pTCPSessions[iTCPSess].sock;
if(FD_ISSET(fdSess, pReadfds)) {
char buf[MAXLINE];
- dprintf("tcp session socket with new data: #%d\n", fdSess);
+ dbgprintf("tcp session socket with new data: #%d\n", fdSess);
/* Receive message */
state = recv(fdSess, buf, sizeof(buf), 0);
@@ -5647,7 +5647,7 @@ static void mainloop(void)
while(iTCPSess != -1) {
int fdSess;
fdSess = pTCPSessions[iTCPSess].sock;
- dprintf("Adding TCP Session %d\n", fdSess);
+ dbgprintf("Adding TCP Session %d\n", fdSess);
FD_SET(fdSess, &readfds);
if (fdSess>maxfds) maxfds=fdSess;
/* now get next... */
@@ -5675,12 +5675,12 @@ static void mainloop(void)
#endif
if ( debugging_on ) {
- dprintf("----------------------------------------\n");
- dprintf("Calling select, active file descriptors (max %d): ", maxfds);
+ dbgprintf("----------------------------------------\n");
+ dbgprintf("Calling select, active file descriptors (max %d): ", maxfds);
for (nfds= 0; nfds <= maxfds; ++nfds)
if ( FD_ISSET(nfds, &readfds) )
- dprintf("%d ", nfds);
- dprintf("\n");
+ dbgprintf("%d ", nfds);
+ dbgprintf("\n");
}
#define MAIN_SELECT_TIMEVAL NULL
@@ -5723,14 +5723,14 @@ static void mainloop(void)
*/
}
if(restart) {
- dprintf("\nReceived SIGHUP, reloading rsyslogd.\n");
+ dbgprintf("\nReceived SIGHUP, reloading rsyslogd.\n");
/* worker thread is stopped as part of init() */
init();
restart = 0;
continue;
}
if (nfds == 0) {
- dprintf("No select activity.\n");
+ dbgprintf("No select activity.\n");
continue;
}
@@ -6033,7 +6033,7 @@ int main(int argc, char **argv)
if ( !(Debug || NoFork) )
{
- dprintf("Checking pidfile.\n");
+ dbgprintf("Checking pidfile.\n");
if (!check_pid(PidFile))
{
signal (SIGTERM, doexit);
@@ -6069,18 +6069,18 @@ int main(int argc, char **argv)
/* tuck my process id away */
if ( !Debug )
{
- dprintf("Writing pidfile.\n");
+ dbgprintf("Writing pidfile.\n");
if (!check_pid(PidFile))
{
if (!write_pid(PidFile))
{
- dprintf("Can't write pid.\n");
+ dbgprintf("Can't write pid.\n");
exit(1); /* exit during startup - questionable */
}
}
else
{
- dprintf("Pidfile (and pid) already exist.\n");
+ dbgprintf("Pidfile (and pid) already exist.\n");
exit(1); /* exit during startup - questionable */
}
} /* if ( !Debug ) */
@@ -6148,10 +6148,10 @@ int main(int argc, char **argv)
(void) signal(SIGXFSZ, SIG_IGN); /* do not abort if 2gig file limit is hit */
(void) alarm(TIMERINTVL);
- dprintf("Starting.\n");
+ dbgprintf("Starting.\n");
init();
if(Debug) {
- dprintf("Debugging enabled, SIGUSR1 to turn off debugging.\n");
+ dbgprintf("Debugging enabled, SIGUSR1 to turn off debugging.\n");
debugging_on = 1;
}
/*
diff --git a/syslogd.h b/syslogd.h
index 3869ecbf..99ce63f2 100644
--- a/syslogd.h
+++ b/syslogd.h
@@ -48,11 +48,7 @@
#define ADDDATE 0x004 /* add a date to the message */
#define MARK 0x008 /* this message is a mark */
-#if defined(__GLIBC__)
-#define dprintf mydprintf
-#endif /* __GLIBC__ */
-
-void dprintf(char *, ...);
+void dbgprintf(char *, ...);
void logerror(char *type);
void logerrorSz(char *type, char *errMsg);
void logerrorInt(char *type, int iErr);
diff --git a/tcpsyslog.c b/tcpsyslog.c
index 8eba78c5..327e7972 100644
--- a/tcpsyslog.c
+++ b/tcpsyslog.c
@@ -82,7 +82,7 @@ struct TCPSession *pTCPSessions;
* "<port-to-use>, <nbr-of-sessions>"
* Typically, there is no whitespace between port and session number.
* (but it may be...).
- * NOTE: you can not use dprintf() in here - the dprintf() system is
+ * NOTE: you can not use dbgprintf() in here - the dbgprintf() system is
* not yet initilized when this function is called.
* rgerhards, 2007-06-21
* We can also not use logerror(), as that system is also not yet
@@ -146,10 +146,10 @@ static int TCPSessInit(void)
register int i;
assert(pTCPSessions == NULL);
- dprintf("Allocating buffer for %d TCP sessions.\n", iTCPSessMax);
+ dbgprintf("Allocating buffer for %d TCP sessions.\n", iTCPSessMax);
if((pTCPSessions = (struct TCPSession *) malloc(sizeof(struct TCPSession) * iTCPSessMax))
== NULL) {
- dprintf("Error: TCPSessInit() could not alloc memory for TCP session table.\n");
+ dbgprintf("Error: TCPSessInit() could not alloc memory for TCP session table.\n");
return(1);
}
@@ -216,7 +216,7 @@ void deinit_tcp_listener(void)
while(iTCPSess != -1) {
int fd;
fd = pTCPSessions[iTCPSess].sock;
- dprintf("Closing TCP Session %d\n", fd);
+ dbgprintf("Closing TCP Session %d\n", fd);
close(fd);
/* now get next... */
iTCPSess = TCPSessGetNxtSess(iTCPSess);
@@ -361,7 +361,7 @@ int *create_tcp_socket(void)
freeaddrinfo(res);
if(Debug && *socks != maxs)
- dprintf("We could initialize %d TCP listen sockets out of %d we received "
+ dbgprintf("We could initialize %d TCP listen sockets out of %d we received "
"- this may or may not be an error indication.\n", *socks, maxs);
if(*socks == 0) {
@@ -500,7 +500,7 @@ void TCPSessPrepareClose(int iTCPSess)
* of message may occur. As such, we process the message in
* this case.
*/
- dprintf("Extra data at end of stream in legacy syslog/tcp message - processing\n");
+ dbgprintf("Extra data at end of stream in legacy syslog/tcp message - processing\n");
printchopped(pTCPSessions[iTCPSess].fromHost, pTCPSessions[iTCPSess].msg,
pTCPSessions[iTCPSess].iMsg, pTCPSessions[iTCPSess].sock, 1);
pTCPSessions[iTCPSess].bAtStrtOfFram = 1;
@@ -606,7 +606,7 @@ int TCPSessDataRcvd(int iTCPSess, char *pData, int iLen)
/* IETF20061218 ++iNbrOctets; */
++pData;
}
- dprintf("TCP Message with octet-counter, size %d.\n", iCnt);
+ dbgprintf("TCP Message with octet-counter, size %d.\n", iCnt);
if(*pData == ' ') {
++pData; /* skip over SP */
/* IETF20061218 ++iNbrOctets; */
@@ -621,7 +621,7 @@ int TCPSessDataRcvd(int iTCPSess, char *pData, int iLen)
pTCPSessions[iTCPSess].iOctetsRemain = iCnt;
if(pTCPSessions[iTCPSess].iOctetsRemain < 1) {
/* TODO: handle the case where the octet count is 0 or negative! */
- dprintf("Framing Error: invalid octet count\n");
+ dbgprintf("Framing Error: invalid octet count\n");
logerrorInt("Framing Error in received TCP message: "
"invalid octet count %d.\n",
pTCPSessions[iTCPSess].iOctetsRemain);
diff --git a/template.c b/template.c
index 38cdf384..6a3fbb7d 100644
--- a/template.c
+++ b/template.c
@@ -60,7 +60,7 @@ uchar *tplToString(struct template *pTpl, msg_t *pMsg)
* loop until we got hold of all values.
*/
if((pCStr = rsCStrConstruct()) == NULL) {
- dprintf("memory shortage, tplToString failed\n");
+ dbgprintf("memory shortage, tplToString failed\n");
return NULL;
}
@@ -71,7 +71,7 @@ uchar *tplToString(struct template *pTpl, msg_t *pMsg)
(uchar *) pTpe->data.constant.pConstant,
pTpe->data.constant.iLenConstant)
) != RS_RET_OK) {
- dprintf("error %d during tplToString()\n", iRet);
+ dbgprintf("error %d during tplToString()\n", iRet);
/* it does not make sense to continue now */
rsCStrDestruct(pCStr);
return NULL;
@@ -91,7 +91,7 @@ uchar *tplToString(struct template *pTpl, msg_t *pMsg)
doSQLEscape(&pVal, &iLenVal, &bMustBeFreed, 0);
/* value extracted, so lets copy */
if((iRet = rsCStrAppendStrWithLen(pCStr, (uchar*) pVal, iLenVal)) != RS_RET_OK) {
- dprintf("error %d during tplToString()\n", iRet);
+ dbgprintf("error %d during tplToString()\n", iRet);
/* it does not make sense to continue now */
rsCStrDestruct(pCStr);
if(bMustBeFreed)
@@ -433,7 +433,7 @@ static void doOptions(unsigned char **pp, struct templateEntry *pTpe)
} else if(!strcmp((char*)Buf, "drop-last-lf")) {
pTpe->data.field.options.bDropLastLF = 1;
} else {
- dprintf("Invalid field option '%s' specified - ignored.\n", Buf);
+ dbgprintf("Invalid field option '%s' specified - ignored.\n", Buf);
}
}
@@ -470,7 +470,7 @@ static int do_Parameter(unsigned char **pp, struct template *pTpl)
if((pTpe = tpeConstruct(pTpl)) == NULL) {
/* TODO: add handler */
- dprintf("Could not allocate memory for template parameter!\n");
+ dbgprintf("Could not allocate memory for template parameter!\n");
return 1;
}
pTpe->eEntryType = FIELD;
@@ -552,7 +552,7 @@ static int do_Parameter(unsigned char **pp, struct template *pTpl)
/* skip to next known good */
while(*p && *p != '%' && *p != ':') {
/* TODO: complain on extra characters */
- dprintf("error: extra character in frompos: '%s'\n", p);
+ dbgprintf("error: extra character in frompos: '%s'\n", p);
++p;
}
}
@@ -567,14 +567,14 @@ static int do_Parameter(unsigned char **pp, struct template *pTpl)
#ifdef FEATURE_REGEXP
if (pTpe->data.field.has_regex) {
- dprintf("debug: has regex \n");
+ dbgprintf("debug: has regex \n");
/* APR 2005-09 I need the string that represent the regex */
/* The regex end is: "--end" */
/* TODO : this is hardcoded and cant be escaped, please change */
regex_end = (unsigned char*) strstr((char*)p, "--end");
if (regex_end == NULL) {
- dprintf("error: can not find regex end in: '%s'\n", p);
+ dbgprintf("error: can not find regex end in: '%s'\n", p);
pTpe->data.field.has_regex = 0;
} else {
/* We get here ONLY if the regex end was found */
@@ -582,7 +582,7 @@ static int do_Parameter(unsigned char **pp, struct template *pTpl)
/* Malloc for the regex string */
regex_char = (unsigned char *) malloc(longitud + 1);
if (regex_char == NULL) {
- dprintf
+ dbgprintf
("Could not allocate memory for template parameter!\n");
pTpe->data.field.has_regex = 0;
return 1;
@@ -593,12 +593,12 @@ static int do_Parameter(unsigned char **pp, struct template *pTpl)
memcpy(regex_char, p, longitud);
regex_char[longitud] = '\0';
- dprintf("debug: regex detected: '%s'\n", regex_char);
+ dbgprintf("debug: regex detected: '%s'\n", regex_char);
/* Now i compile the regex */
/* Remember that the re is an attribute of the Template entry */
if(regcomp(&(pTpe->data.field.re), (char*) regex_char, 0) != 0) {
- dprintf("error: can not compile regex: '%s'\n", regex_char);
+ dbgprintf("error: can not compile regex: '%s'\n", regex_char);
pTpe->data.field.has_regex = 2;
}
@@ -628,7 +628,7 @@ static int do_Parameter(unsigned char **pp, struct template *pTpl)
/* skip to next known good */
while(*p && *p != '%' && *p != ':') {
/* TODO: complain on extra characters */
- dprintf("error: extra character in frompos: '%s'\n", p);
+ dbgprintf("error: extra character in frompos: '%s'\n", p);
++p;
}
#ifdef FEATURE_REGEXP
@@ -676,7 +676,7 @@ struct template *tplAddLine(char* pName, unsigned char** ppRestOfConfLine)
pTpl->iLenName = strlen(pName);
pTpl->pszName = (char*) malloc(sizeof(char) * (pTpl->iLenName + 1));
if(pTpl->pszName == NULL) {
- dprintf("tplAddLine could not alloc memory for template name!");
+ dbgprintf("tplAddLine could not alloc memory for template name!");
pTpl->iLenName = 0;
return NULL;
/* I know - we create a memory leak here - but I deem
@@ -694,7 +694,7 @@ struct template *tplAddLine(char* pName, unsigned char** ppRestOfConfLine)
++p;
if(*p != '"') {
- dprintf("Template '%s' invalid, does not start with '\"'!\n", pTpl->pszName);
+ dbgprintf("Template '%s' invalid, does not start with '\"'!\n", pTpl->pszName);
/* we simply make the template defunct in this case by setting
* its name to a zero-string. We do not free it, as this would
* require additional code and causes only a very small memory
@@ -764,7 +764,7 @@ struct template *tplAddLine(char* pName, unsigned char** ppRestOfConfLine)
} else if(!strcmp(optBuf, "nosql")) {
pTpl->optFormatForSQL = 0;
} else {
- dprintf("Invalid option '%s' ignored.\n", optBuf);
+ dbgprintf("Invalid option '%s' ignored.\n", optBuf);
}
}
@@ -799,7 +799,7 @@ struct template *tplFind(char *pName, int iLenName)
/* Destroy the template structure. This is for de-initialization
* at program end. Everything is deleted.
* rgerhards 2005-02-22
- * I have commented out dprintfs, because they are not needed for
+ * I have commented out dbgprintfs, because they are not needed for
* "normal" debugging. Uncomment them, if they are needed.
* rgerhards, 2007-07-05
*/
@@ -810,27 +810,27 @@ void tplDeleteAll(void)
pTpl = tplRoot;
while(pTpl != NULL) {
- /* dprintf("Delete Template: Name='%s'\n ", pTpl->pszName == NULL? "NULL" : pTpl->pszName);*/
+ /* dbgprintf("Delete Template: Name='%s'\n ", pTpl->pszName == NULL? "NULL" : pTpl->pszName);*/
pTpe = pTpl->pEntryRoot;
while(pTpe != NULL) {
pTpeDel = pTpe;
pTpe = pTpe->pNext;
- /*dprintf("\tDelete Entry(%x): type %d, ", (unsigned) pTpeDel, pTpeDel->eEntryType);*/
+ /*dbgprintf("\tDelete Entry(%x): type %d, ", (unsigned) pTpeDel, pTpeDel->eEntryType);*/
switch(pTpeDel->eEntryType) {
case UNDEFINED:
- /*dprintf("(UNDEFINED)");*/
+ /*dbgprintf("(UNDEFINED)");*/
break;
case CONSTANT:
- /*dprintf("(CONSTANT), value: '%s'",
+ /*dbgprintf("(CONSTANT), value: '%s'",
pTpeDel->data.constant.pConstant);*/
free(pTpeDel->data.constant.pConstant);
break;
case FIELD:
- /*dprintf("(FIELD), value: '%s'", pTpeDel->data.field.pPropRepl);*/
+ /*dbgprintf("(FIELD), value: '%s'", pTpeDel->data.field.pPropRepl);*/
free(pTpeDel->data.field.pPropRepl);
break;
}
- /*dprintf("\n");*/
+ /*dbgprintf("\n");*/
free(pTpeDel);
}
pTplDel = pTpl;
@@ -856,27 +856,27 @@ void tplDeleteNew(void)
tplLastStatic->pNext = NULL;
tplLast = tplLastStatic;
while(pTpl != NULL) {
- /* dprintf("Delete Template: Name='%s'\n ", pTpl->pszName == NULL? "NULL" : pTpl->pszName);*/
+ /* dbgprintf("Delete Template: Name='%s'\n ", pTpl->pszName == NULL? "NULL" : pTpl->pszName);*/
pTpe = pTpl->pEntryRoot;
while(pTpe != NULL) {
pTpeDel = pTpe;
pTpe = pTpe->pNext;
- /*dprintf("\tDelete Entry(%x): type %d, ", (unsigned) pTpeDel, pTpeDel->eEntryType);*/
+ /*dbgprintf("\tDelete Entry(%x): type %d, ", (unsigned) pTpeDel, pTpeDel->eEntryType);*/
switch(pTpeDel->eEntryType) {
case UNDEFINED:
- /*dprintf("(UNDEFINED)");*/
+ /*dbgprintf("(UNDEFINED)");*/
break;
case CONSTANT:
- /*dprintf("(CONSTANT), value: '%s'",
+ /*dbgprintf("(CONSTANT), value: '%s'",
pTpeDel->data.constant.pConstant);*/
free(pTpeDel->data.constant.pConstant);
break;
case FIELD:
- /*dprintf("(FIELD), value: '%s'", pTpeDel->data.field.pPropRepl);*/
+ /*dbgprintf("(FIELD), value: '%s'", pTpeDel->data.field.pPropRepl);*/
free(pTpeDel->data.field.pPropRepl);
break;
}
- /*dprintf("\n");*/
+ /*dbgprintf("\n");*/
free(pTpeDel);
}
pTplDel = pTpl;
@@ -903,74 +903,74 @@ void tplPrintList(void)
pTpl = tplRoot;
while(pTpl != NULL) {
- dprintf("Template: Name='%s' ", pTpl->pszName == NULL? "NULL" : pTpl->pszName);
+ dbgprintf("Template: Name='%s' ", pTpl->pszName == NULL? "NULL" : pTpl->pszName);
if(pTpl->optFormatForSQL == 1)
- dprintf("[SQL-Format (MySQL)] ");
+ dbgprintf("[SQL-Format (MySQL)] ");
else if(pTpl->optFormatForSQL == 2)
- dprintf("[SQL-Format (standard SQL)] ");
- dprintf("\n");
+ dbgprintf("[SQL-Format (standard SQL)] ");
+ dbgprintf("\n");
pTpe = pTpl->pEntryRoot;
while(pTpe != NULL) {
- dprintf("\tEntry(%x): type %d, ", (unsigned) pTpe, pTpe->eEntryType);
+ dbgprintf("\tEntry(%x): type %d, ", (unsigned) pTpe, pTpe->eEntryType);
switch(pTpe->eEntryType) {
case UNDEFINED:
- dprintf("(UNDEFINED)");
+ dbgprintf("(UNDEFINED)");
break;
case CONSTANT:
- dprintf("(CONSTANT), value: '%s'",
+ dbgprintf("(CONSTANT), value: '%s'",
pTpe->data.constant.pConstant);
break;
case FIELD:
- dprintf("(FIELD), value: '%s' ", pTpe->data.field.pPropRepl);
+ dbgprintf("(FIELD), value: '%s' ", pTpe->data.field.pPropRepl);
switch(pTpe->data.field.eDateFormat) {
case tplFmtDefault:
break;
case tplFmtMySQLDate:
- dprintf("[Format as MySQL-Date] ");
+ dbgprintf("[Format as MySQL-Date] ");
break;
case tplFmtRFC3164Date:
- dprintf("[Format as RFC3164-Date] ");
+ dbgprintf("[Format as RFC3164-Date] ");
break;
case tplFmtRFC3339Date:
- dprintf("[Format as RFC3339-Date] ");
+ dbgprintf("[Format as RFC3339-Date] ");
break;
default:
- dprintf("[INVALID eDateFormat %d] ", pTpe->data.field.eDateFormat);
+ dbgprintf("[INVALID eDateFormat %d] ", pTpe->data.field.eDateFormat);
}
switch(pTpe->data.field.eCaseConv) {
case tplCaseConvNo:
break;
case tplCaseConvLower:
- dprintf("[Converted to Lower Case] ");
+ dbgprintf("[Converted to Lower Case] ");
break;
case tplCaseConvUpper:
- dprintf("[Converted to Upper Case] ");
+ dbgprintf("[Converted to Upper Case] ");
break;
}
if(pTpe->data.field.options.bEscapeCC) {
- dprintf("[escape control-characters] ");
+ dbgprintf("[escape control-characters] ");
}
if(pTpe->data.field.options.bDropCC) {
- dprintf("[drop control-characters] ");
+ dbgprintf("[drop control-characters] ");
}
if(pTpe->data.field.options.bSpaceCC) {
- dprintf("[replace control-characters with space] ");
+ dbgprintf("[replace control-characters with space] ");
}
if(pTpe->data.field.options.bDropLastLF) {
- dprintf("[drop last LF in msg] ");
+ dbgprintf("[drop last LF in msg] ");
}
if(pTpe->data.field.has_fields == 1) {
- dprintf("[substring, field #%d only (delemiter %d)] ",
+ dbgprintf("[substring, field #%d only (delemiter %d)] ",
pTpe->data.field.iToPos, pTpe->data.field.field_delim);
} else if(pTpe->data.field.iFromPos != 0 ||
pTpe->data.field.iToPos != 0) {
- dprintf("[substring, from character %d to %d] ",
+ dbgprintf("[substring, from character %d to %d] ",
pTpe->data.field.iFromPos,
pTpe->data.field.iToPos);
}
break;
}
- dprintf("\n");
+ dbgprintf("\n");
pTpe = pTpe->pNext;
}
pTpl = pTpl->pNext; /* done, go next */