]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
REORG: trace: rename trace.c to calltrace.c and mention it's not thread-safe
authorWilly Tarreau <w@1wt.eu>
Thu, 8 Aug 2019 14:53:40 +0000 (16:53 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 22 Aug 2019 18:21:00 +0000 (20:21 +0200)
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.

Makefile
include/common/standard.h
src/calltrace.c [moved from src/trace.c with 98% similarity]

index 419d3ea1e42dc645c81dcfd644089469c11985e6..e19e5494fda191eaecf0fe435265bfde08e165f5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -785,7 +785,7 @@ EBTREE_OBJS = $(EBTREE_DIR)/ebtree.o $(EBTREE_DIR)/eb32sctree.o \
               $(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 @@ objsize: haproxy
 # 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)
index ffebac8ee7fb7db0f08e2eb60ad8ae3a59b54b83..f0167d31aab971d498b6e96686640d12ad16093f 100644 (file)
@@ -1275,9 +1275,9 @@ char *env_expand(char *in);
  */
 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.
similarity index 98%
rename from src/trace.c
rename to src/calltrace.c
index ab23a74eda492e23f82e04af11617e409113aed9..1a03709f4bb788ae8c1f130caa9e1242901a52af 100644 (file)
@@ -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 @@ void __cyg_profile_func_exit(void *to,  void *from)
  * <timestamp> <level> # <string>
  */
 __attribute__((format(printf, 1, 2)))
-void trace(char *fmt, ...)
+void calltrace(char *fmt, ...)
 {
        va_list ap;