REORG: trace: rename trace.c to calltrace.c and mention it's not thread-safe
The function call tracing code is a quite old and was never ported to
support threads. It's not even sure whether it still works well, but
at least its presence creates confusion for future work so let's rename
it to calltrace.c and add a comment about its lack of thread-safety.
diff --git a/Makefile b/Makefile
index 419d3ea..e19e549 100644
--- a/Makefile
+++ b/Makefile
@@ -785,7 +785,7 @@
$(EBTREE_DIR)/ebimtree.o $(EBTREE_DIR)/ebistree.o
ifneq ($(TRACE),)
-OBJS += src/trace.o
+OBJS += src/calltrace.o
endif
ifneq ($(EXTRA_OBJS),)
@@ -837,7 +837,7 @@
# rebuild it every time
.PHONY: src/version.c
-src/trace.o: src/trace.c $(DEP)
+src/calltrace.o: src/calltrace.c $(DEP)
$(cmd_CC) $(TRACE_COPTS) -c -o $@ $<
src/haproxy.o: src/haproxy.c $(DEP)
diff --git a/include/common/standard.h b/include/common/standard.h
index ffebac8..f0167d3 100644
--- a/include/common/standard.h
+++ b/include/common/standard.h
@@ -1275,9 +1275,9 @@
*/
void debug_hexdump(FILE *out, const char *pfx, const char *buf, unsigned int baseaddr, int len);
-/* this is used to emit traces when building with TRACE=1 */
+/* this is used to emit call traces when building with TRACE=1 */
__attribute__((format(printf, 1, 2)))
-void trace(char *fmt, ...);
+void calltrace(char *fmt, ...);
/* used from everywhere just to drain results we don't want to read and which
* recent versions of gcc increasingly and annoyingly complain about.
diff --git a/src/trace.c b/src/calltrace.c
similarity index 97%
rename from src/trace.c
rename to src/calltrace.c
index ab23a74..1a03709 100644
--- a/src/trace.c
+++ b/src/calltrace.c
@@ -1,5 +1,6 @@
/*
* Function call tracing for gcc >= 2.95
+ * WARNING! THIS CODE IS NOT THREAD-SAFE!
*
* Copyright 2012 Willy Tarreau <w@1wt.eu>
*
@@ -29,7 +30,7 @@
*
* where <dir> is '>' when entering a function and '<' when leaving.
*
- * It is also possible to emit comments using the trace() function which uses
+ * It is also possible to emit comments using the calltrace() function which uses
* the printf() format. Such comments are then inserted by replacing the caller
* pointer with a sharp ('#') like this :
*
@@ -257,7 +258,7 @@
* <timestamp> <level> # <string>
*/
__attribute__((format(printf, 1, 2)))
-void trace(char *fmt, ...)
+void calltrace(char *fmt, ...)
{
va_list ap;