summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
756c692)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <pthread.h>
#include <stdio.h>
#include <inttypes.h>
#include <pthread.h>
#include <stdio.h>
#include <inttypes.h>
#include <urcu/rculfhash.h>
/*
#include <urcu/rculfhash.h>
/*
+#ifdef __linux__
+#include <syscall.h>
+#endif
+
+#if defined(_syscall0)
+_syscall0(pid_t, gettid)
+#elif defined(__NR_gettid)
+static inline pid_t gettid(void)
+{
+ return syscall(__NR_gettid);
+}
+#else
+#warning "use pid as tid"
+static inline pid_t gettid(void)
+{
+ return getpid();
+}
+#endif
+
-#define dbg_printf(fmt, args...) printf("[debug rcuja] " fmt, ## args)
+#define dbg_printf(fmt, args...) \
+ fprintf(stderr, "[debug rcuja %lu %s()@%s:%u] " fmt, \
+ (unsigned long) gettid(), __func__, \
+ __FILE__, __LINE__, ## args)
#else
#define dbg_printf(fmt, args...) \
do { \
/* do nothing but check printf format */ \
if (0) \
#else
#define dbg_printf(fmt, args...) \
do { \
/* do nothing but check printf format */ \
if (0) \
- printf("[debug rcuja] " fmt, ## args); \
+ fprintf(stderr, "[debug rcuja %lu %s()@%s:%u] " fmt, \
+ (unsigned long) gettid(), __func__, \
+ __FILE__, __LINE__, ## args); \