summaryrefslogtreecommitdiffstats
path: root/debug.h
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-01-23 09:35:30 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-01-23 09:35:30 +0000
commit4604f73f46cee99988fb8ba0083599b835066ff9 (patch)
tree75165d8b0c4dc9c69c1fd61bd6fc017795ddd9b8 /debug.h
parent3ab9ce1b9f30e901735576a4c89faf4521d4b08e (diff)
downloadrsyslog-4604f73f46cee99988fb8ba0083599b835066ff9.tar.gz
rsyslog-4604f73f46cee99988fb8ba0083599b835066ff9.tar.xz
rsyslog-4604f73f46cee99988fb8ba0083599b835066ff9.zip
added mutex debug instrumentation
Diffstat (limited to 'debug.h')
-rw-r--r--debug.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/debug.h b/debug.h
index ecc599e1..ec689bf4 100644
--- a/debug.h
+++ b/debug.h
@@ -25,13 +25,21 @@
#ifndef DEBUG_H_INCLUDED
#define DEBUG_H_INCLUDED
+#include <pthread.h>
+
/* external static data elements (some time to be replaced) */
extern int Debug; /* debug flag - read-only after startup */
extern int debugging_on; /* read-only, except on sig USR1 */
/* prototypes */
rsRetVal dbgClassInit(void);
+rsRetVal dbgClassExit(void);
void sigsegvHdlr(int signum);
+int dbgCondTimedWait(pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime,
+ const char *file, const char* func, int line);
+int dbgCondWait(pthread_cond_t *cond, pthread_mutex_t *mutex, const char *file, const char* func, int line);
+int dbgMutexUnlock(pthread_mutex_t *pmut, const char *file, const char* func, int line);
+int dbgMutexLock(pthread_mutex_t *pmut, const char *file, const char* func, int line);
void dbgprintf(char *fmt, ...) __attribute__((format(printf,1, 2)));
void dbgEntrFunc(char* file, int line, const char* func);
void dbgExitFunc(char* file, int line, const char* func);
@@ -52,4 +60,22 @@ void dbgExitFunc(char* file, int line, const char* func);
# define RUNLOG_VAR(x)
#endif
+/* mutex operations */
+#define MUTOP_LOCKWAIT 1
+#define MUTOP_LOCK 2
+#define MUTOP_UNLOCK 3
+
+
+/* debug aides */
+#if 1
+#define d_pthread_mutex_lock(x) dbgMutexLock(x, __FILE__, __func__, __LINE__)
+#define d_pthread_mutex_unlock(x) dbgMutexLock(x, __FILE__, __func__, __LINE__)
+#define d_pthread_cond_wait(cond, mut) dbgCondWait(cond, mut, __FILE__, __func__, __LINE__)
+#define d_pthread_cond_timedwait(cond, mut, to) dbgCondTimedWait(cond, mut, to, __FILE__, __func__, __LINE__)
+#else
+#define d_pthread_mutex_lock(x) pthread_mutex_lock(x)
+#define d_pthread_mutex_unlock(x) pthread_mutex_unlock(x)
+#define d_pthread_cond_wait(cond, mut) pthread_cond_wait(cond, mut)
+#define d_pthread_cond_timedwait(cond, mut, to) pthread_cond_timedwait(cond, mut, to)
+#endif
#endif /* #ifndef DEBUG_H_INCLUDED */