diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-03-06 10:47:24 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-03-06 10:47:24 +0000 |
commit | 697efa964e697594a6df469c6958900136fc6881 (patch) | |
tree | 3451e7e476158ccaa57801ab63f7b0083f9825af | |
parent | 3d102311504486baa1e99bcc1a0296f6d9e77029 (diff) | |
download | rsyslog-697efa964e697594a6df469c6958900136fc6881.tar.gz rsyslog-697efa964e697594a6df469c6958900136fc6881.tar.xz rsyslog-697efa964e697594a6df469c6958900136fc6881.zip |
portability: no longer using pthread mutex auto-init macros as they seem to
be buggy on some platforms
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | debug.c | 25 |
2 files changed, 20 insertions, 11 deletions
@@ -1,12 +1,12 @@ --------------------------------------------------------------------------- -Version 3.12.1 (rgerhards), 2008-03-?? +Version 3.12.1 (rgerhards), 2008-03-06 +- added library plugins, which can be automatically loaded +- bugfix: actions were not correctly retried; caused message loss - changed module loader to automatically add ".so" suffix if not specified (over time, this shall also ease portability of config files) -- bugfix: actions were not correctly retried; caused message loss - improved debugging support; debug runtime options can now be set via an environment variable -- added library plugins, which can be automatically loaded - bugfix: removed debugging code that I forgot to remove before releasing 3.12.0 (does not cause harm and happened only during startup) - added support for the MonitorWare syslog MIB to omsnmp @@ -93,7 +93,7 @@ typedef struct dbgFuncDBListEntry_s { } dbgFuncDBListEntry_t; dbgFuncDBListEntry_t *pFuncDBListRoot; -static pthread_mutex_t mutFuncDBList = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t mutFuncDBList; typedef struct dbgMutLog_s { struct dbgMutLog_s *pNext; @@ -106,15 +106,15 @@ typedef struct dbgMutLog_s { } dbgMutLog_t; static dbgMutLog_t *dbgMutLogListRoot = NULL; static dbgMutLog_t *dbgMutLogListLast = NULL; -static pthread_mutex_t mutMutLog = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t mutMutLog; static dbgThrdInfo_t *dbgCallStackListRoot = NULL; static dbgThrdInfo_t *dbgCallStackListLast = NULL; -static pthread_mutex_t mutCallStack = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t mutCallStack; -static pthread_mutex_t mutdbgprintf = PTHREAD_MUTEX_INITIALIZER; -static pthread_mutex_t mutdbgoprint = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t mutdbgprintf; +static pthread_mutex_t mutdbgoprint; static pthread_key_t keyCallStack; @@ -628,10 +628,10 @@ static void dbgGetThrdName(char *pszBuf, size_t lenBuf, pthread_t thrd, int bInc if(pThrd == 0 || pThrd->pszThrdName == NULL) { /* no thread name, use numeric value */ - snprintf(pszBuf, lenBuf, "%lx", thrd); + snprintf(pszBuf, lenBuf, "%lx", (long) thrd); } else { if(bIncludeNumID) { - snprintf(pszBuf, lenBuf, "%s (%lx)", pThrd->pszThrdName, thrd); + snprintf(pszBuf, lenBuf, "%s (%lx)", pThrd->pszThrdName, (long) thrd); } else { snprintf(pszBuf, lenBuf, "%s", pThrd->pszThrdName); } @@ -982,7 +982,7 @@ void dbgExitFunc(dbgFuncDB_t *pFuncDB, int iStackPtrRestore, int iRet) } pThrd->stackPtr = iStackPtrRestore; if(pThrd->stackPtr < 0) { - dbgprintf("Stack pointer for thread %lx below 0 - resetting (some RETiRet still wrong!)\n", pthread_self()); + dbgprintf("Stack pointer for thread %lx below 0 - resetting (some RETiRet still wrong!)\n", (long) pthread_self()); pThrd->stackPtr = 0; } } @@ -1211,6 +1211,15 @@ rsRetVal dbgClassInit(void) (void) pthread_key_create(&keyCallStack, dbgCallStackDestruct); /* MUST be the first action done! */ + /* we initialize all Mutexes with code, as some platforms seem to have + * bugs in the static initializer macros. So better be on the safe side... + * rgerhards, 2008-03-06 + */ + pthread_mutex_init(&mutFuncDBList, NULL); + pthread_mutex_init(&mutMutLog, NULL); + pthread_mutex_init(&mutCallStack, NULL); + pthread_mutex_init(&mutdbgprintf, NULL); + pthread_mutex_init(&mutdbgoprint, NULL); /* while we try not to use any of the real rsyslog code (to avoid infinite loops), we * need to have the ability to query object names. Thus, we need to obtain a pointer to |