summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--runtime/datetime.c8
-rw-r--r--runtime/datetime.h8
-rw-r--r--runtime/msg.c18
-rw-r--r--runtime/wtp.c6
-rw-r--r--tools/syslogd.c2
6 files changed, 29 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 0cef1a0d..7c0e03ca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -68,6 +68,11 @@ Version 4.5.0 [DEVEL] (rgerhards), 2009-??-??
* $MainMsgQueueSyncQueueFiles
* $ActionQueueSyncQueueFiles
- done some memory accesses explicitely atomic
+- bugfix: subtle (and usually irrelevant) issue in timout processing
+ timeout could be one second too early if nanoseconds wrapped
+- set a more sensible timeout for shutdow, now 1.5 seconds to complete
+ processing (this also removes those cases where the shutdown message
+ was not written because the termination happened before it)
---------------------------------------------------------------------------
Version 4.3.2 [beta] (rgerhards), 2009-06-24
- removed long-obsoleted property UxTradMsg
diff --git a/runtime/datetime.c b/runtime/datetime.c
index 069cf55c..5b9f5b6d 100644
--- a/runtime/datetime.c
+++ b/runtime/datetime.c
@@ -548,7 +548,7 @@ finalize_it:
* returns the size of the timestamp written in bytes (without
* the string terminator). If 0 is returend, an error occured.
*/
-int formatTimestampToMySQL(struct syslogTime *ts, char* pBuf, size_t iLenDst)
+int formatTimestampToMySQL(struct syslogTime *ts, char* pBuf)
{
/* currently we do not consider localtime/utc. This may later be
* added. If so, I recommend using a property replacer option
@@ -579,7 +579,7 @@ int formatTimestampToMySQL(struct syslogTime *ts, char* pBuf, size_t iLenDst)
}
-int formatTimestampToPgSQL(struct syslogTime *ts, char *pBuf, size_t iLenDst)
+int formatTimestampToPgSQL(struct syslogTime *ts, char *pBuf)
{
/* see note in formatTimestampToMySQL, applies here as well */
assert(ts != NULL);
@@ -657,7 +657,7 @@ int formatTimestampSecFrac(struct syslogTime *ts, char* pBuf)
* returns the size of the timestamp written in bytes (without
* the string terminator). If 0 is returend, an error occured.
*/
-int formatTimestamp3339(struct syslogTime *ts, char* pBuf, size_t iLenBuf)
+int formatTimestamp3339(struct syslogTime *ts, char* pBuf)
{
int iBuf;
int power;
@@ -734,7 +734,7 @@ int formatTimestamp3339(struct syslogTime *ts, char* pBuf, size_t iLenBuf)
* returns the size of the timestamp written in bytes (without
* the string termnator). If 0 is returend, an error occured.
*/
-int formatTimestamp3164(struct syslogTime *ts, char* pBuf, size_t iLenBuf)
+int formatTimestamp3164(struct syslogTime *ts, char* pBuf)
{
static char* monthNames[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
diff --git a/runtime/datetime.h b/runtime/datetime.h
index 1ea99aba..79a86d05 100644
--- a/runtime/datetime.h
+++ b/runtime/datetime.h
@@ -38,10 +38,10 @@ BEGINinterface(datetime) /* name must also be changed in ENDinterface macro! */
void (*getCurrTime)(struct syslogTime *t, time_t *ttSeconds);
rsRetVal (*ParseTIMESTAMP3339)(struct syslogTime *pTime, uchar** ppszTS);
rsRetVal (*ParseTIMESTAMP3164)(struct syslogTime *pTime, uchar** pszTS);
- int (*formatTimestampToMySQL)(struct syslogTime *ts, char* pDst, size_t iLenDst);
- int (*formatTimestampToPgSQL)(struct syslogTime *ts, char *pDst, size_t iLenDst);
- int (*formatTimestamp3339)(struct syslogTime *ts, char* pBuf, size_t iLenBuf);
- int (*formatTimestamp3164)(struct syslogTime *ts, char* pBuf, size_t iLenBuf);
+ int (*formatTimestampToMySQL)(struct syslogTime *ts, char* pDst);
+ int (*formatTimestampToPgSQL)(struct syslogTime *ts, char *pDst);
+ int (*formatTimestamp3339)(struct syslogTime *ts, char* pBuf);
+ int (*formatTimestamp3164)(struct syslogTime *ts, char* pBuf);
int (*formatTimestampSecFrac)(struct syslogTime *ts, char* pBuf);
ENDinterface(datetime)
#define datetimeCURR_IF_VERSION 2 /* increment whenever you change the interface structure! */
diff --git a/runtime/msg.c b/runtime/msg.c
index a1a4714f..75933d68 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -1009,7 +1009,7 @@ static inline char *getTimeReported(msg_t *pM, enum tplFormatTypes eFmt)
MsgLock(pM);
if(pM->pszTIMESTAMP3164 == NULL) {
pM->pszTIMESTAMP3164 = pM->pszTimestamp3164;
- datetime.formatTimestamp3164(&pM->tTIMESTAMP, pM->pszTIMESTAMP3164, 16);
+ datetime.formatTimestamp3164(&pM->tTIMESTAMP, pM->pszTIMESTAMP3164);
}
MsgUnlock(pM);
return(pM->pszTIMESTAMP3164);
@@ -1020,7 +1020,7 @@ static inline char *getTimeReported(msg_t *pM, enum tplFormatTypes eFmt)
MsgUnlock(pM);
return "";
}
- datetime.formatTimestampToMySQL(&pM->tTIMESTAMP, pM->pszTIMESTAMP_MySQL, 15);
+ datetime.formatTimestampToMySQL(&pM->tTIMESTAMP, pM->pszTIMESTAMP_MySQL);
}
MsgUnlock(pM);
return(pM->pszTIMESTAMP_MySQL);
@@ -1031,7 +1031,7 @@ static inline char *getTimeReported(msg_t *pM, enum tplFormatTypes eFmt)
MsgUnlock(pM);
return "";
}
- datetime.formatTimestampToPgSQL(&pM->tTIMESTAMP, pM->pszTIMESTAMP_PgSQL, 21);
+ datetime.formatTimestampToPgSQL(&pM->tTIMESTAMP, pM->pszTIMESTAMP_PgSQL);
}
MsgUnlock(pM);
return(pM->pszTIMESTAMP_PgSQL);
@@ -1039,7 +1039,7 @@ static inline char *getTimeReported(msg_t *pM, enum tplFormatTypes eFmt)
MsgLock(pM);
if(pM->pszTIMESTAMP3339 == NULL) {
pM->pszTIMESTAMP3339 = pM->pszTimestamp3339;
- datetime.formatTimestamp3339(&pM->tTIMESTAMP, pM->pszTIMESTAMP3339, 33);
+ datetime.formatTimestamp3339(&pM->tTIMESTAMP, pM->pszTIMESTAMP3339);
}
MsgUnlock(pM);
return(pM->pszTIMESTAMP3339);
@@ -1072,7 +1072,7 @@ static inline char *getTimeGenerated(msg_t *pM, enum tplFormatTypes eFmt)
MsgUnlock(pM);
return "";
}
- datetime.formatTimestamp3164(&pM->tRcvdAt, pM->pszRcvdAt3164, 16);
+ datetime.formatTimestamp3164(&pM->tRcvdAt, pM->pszRcvdAt3164);
}
MsgUnlock(pM);
return(pM->pszRcvdAt3164);
@@ -1083,7 +1083,7 @@ static inline char *getTimeGenerated(msg_t *pM, enum tplFormatTypes eFmt)
MsgUnlock(pM);
return "";
}
- datetime.formatTimestampToMySQL(&pM->tRcvdAt, pM->pszRcvdAt_MySQL, 15);
+ datetime.formatTimestampToMySQL(&pM->tRcvdAt, pM->pszRcvdAt_MySQL);
}
MsgUnlock(pM);
return(pM->pszRcvdAt_MySQL);
@@ -1094,7 +1094,7 @@ static inline char *getTimeGenerated(msg_t *pM, enum tplFormatTypes eFmt)
MsgUnlock(pM);
return "";
}
- datetime.formatTimestampToPgSQL(&pM->tRcvdAt, pM->pszRcvdAt_PgSQL, 21);
+ datetime.formatTimestampToPgSQL(&pM->tRcvdAt, pM->pszRcvdAt_PgSQL);
}
MsgUnlock(pM);
return(pM->pszRcvdAt_PgSQL);
@@ -1105,7 +1105,7 @@ static inline char *getTimeGenerated(msg_t *pM, enum tplFormatTypes eFmt)
MsgUnlock(pM);
return "";
}
- datetime.formatTimestamp3164(&pM->tRcvdAt, pM->pszRcvdAt3164, 16);
+ datetime.formatTimestamp3164(&pM->tRcvdAt, pM->pszRcvdAt3164);
}
MsgUnlock(pM);
return(pM->pszRcvdAt3164);
@@ -1116,7 +1116,7 @@ static inline char *getTimeGenerated(msg_t *pM, enum tplFormatTypes eFmt)
MsgUnlock(pM);
return "";
}
- datetime.formatTimestamp3339(&pM->tRcvdAt, pM->pszRcvdAt3339, 33);
+ datetime.formatTimestamp3339(&pM->tRcvdAt, pM->pszRcvdAt3339);
}
MsgUnlock(pM);
return(pM->pszRcvdAt3339);
diff --git a/runtime/wtp.c b/runtime/wtp.c
index f5769a72..dc9cbb75 100644
--- a/runtime/wtp.c
+++ b/runtime/wtp.c
@@ -40,6 +40,7 @@
#include <unistd.h>
#include <errno.h>
#include <atomic.h>
+#include <sys/prctl.h>
/// TODO: check on solaris if this is any longer needed - I don't think so - rgerhards, 2009-09-20
//#ifdef OS_SOLARIS
@@ -438,6 +439,11 @@ wtpWorker(void *arg) /* the arg is actually a wti object, even though we are in
sigfillset(&sigSet);
pthread_sigmask(SIG_BLOCK, &sigSet, NULL);
+ /* set thread name - we ignore if the call fails, has no harsh consequences... */
+ if(prctl(PR_SET_NAME, wtpGetDbgHdr(pThis), 0, 0, 0) != 0) {
+ DBGPRINTF("prctl failed, not setting thread name for '%s'\n", wtpGetDbgHdr(pThis));
+ }
+
BEGIN_MTX_PROTECTED_OPERATIONS(&pThis->mut, LOCK_MUTEX);
/* do some late initialization */
diff --git a/tools/syslogd.c b/tools/syslogd.c
index 6a3fa6c9..72687495 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -2516,7 +2516,7 @@ init(void)
exit(1);
}
/* name our main queue object (it's not fatal if it fails...) */
- obj.SetName((obj_t*) pMsgQueue, (uchar*) "main queue");
+ obj.SetName((obj_t*) pMsgQueue, (uchar*) "main Q");
/* ... set some properties ... */
# define setQPROP(func, directive, data) \