[PATCH v4 04/37] unwind: add unwind_ as prefix to functions exported from unwind.c

Masatake YAMATO yamato at redhat.com
Wed Apr 16 06:33:02 UTC 2014


Add "unwind_" as prefix to functions exported from unwind.c.

As suggested by Dmitry V. Levin <ldv at altlinux.org>, in this patch I remove unnecessary
indirections of calls (wrapper functions).

Signed-off-by: Masatake YAMATO <yamato at redhat.com>
---
 defs.h    | 10 +++++-----
 mem.c     |  6 +++---
 process.c |  2 +-
 strace.c  |  6 +++---
 syscall.c |  2 +-
 unwind.c  | 12 ++++++------
 6 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/defs.h b/defs.h
index 7a838bb..e0d5a08 100644
--- a/defs.h
+++ b/defs.h
@@ -727,11 +727,11 @@ extern void tv_mul(struct timeval *, struct timeval *, int);
 extern void tv_div(struct timeval *, struct timeval *, int);
 
 #ifdef USE_LIBUNWIND
-extern void init_unwind_addr_space(void);
-extern void init_libunwind_ui(struct tcb *tcp);
-extern void free_libunwind_ui(struct tcb *tcp);
-extern void delete_mmap_cache(struct tcb* tcp);
-extern void print_stacktrace(struct tcb* tcp);
+extern void unwind_init(void);
+extern void unwind_tcb_init(struct tcb *tcp);
+extern void unwind_tcb_fin(struct tcb *tcp);
+extern void unwind_delete_mmap_cache(struct tcb* tcp);
+extern void unwind_print_stacktrace(struct tcb* tcp);
 #endif
 
 /* Strace log generation machinery.
diff --git a/mem.c b/mem.c
index 7038489..14489c5 100644
--- a/mem.c
+++ b/mem.c
@@ -180,7 +180,7 @@ print_mmap(struct tcb *tcp, long *u_arg, unsigned long long offset)
 	if (entering(tcp)) {
 #ifdef USE_LIBUNWIND
 		if (stack_trace_enabled)
-			delete_mmap_cache(tcp);
+			unwind_delete_mmap_cache(tcp);
 #endif
 
 		/* addr */
@@ -315,7 +315,7 @@ sys_munmap(struct tcb *tcp)
 #ifdef USE_LIBUNWIND
 	else {
 		if (stack_trace_enabled)
-			delete_mmap_cache(tcp);
+			unwind_delete_mmap_cache(tcp);
 	}
 #endif
 	return 0;
@@ -332,7 +332,7 @@ sys_mprotect(struct tcb *tcp)
 #ifdef USE_LIBUNWIND
 	else {
 		if (stack_trace_enabled)
-			delete_mmap_cache(tcp);
+			unwind_delete_mmap_cache(tcp);
 	}
 #endif
 	return 0;
diff --git a/process.c b/process.c
index ccd151c..453574e 100644
--- a/process.c
+++ b/process.c
@@ -993,7 +993,7 @@ sys_execve(struct tcb *tcp)
 #ifdef USE_LIBUNWIND
 	else {
 		if (stack_trace_enabled)
-			delete_mmap_cache(tcp);
+			unwind_delete_mmap_cache(tcp);
 	}
 #endif
 
diff --git a/strace.c b/strace.c
index 8de7b28..d066219 100644
--- a/strace.c
+++ b/strace.c
@@ -696,7 +696,7 @@ alloctcb(int pid)
 
 #ifdef USE_LIBUNWIND
 			if (stack_trace_enabled)
-				init_libunwind_ui(tcp);
+				unwind_tcb_init(tcp);
 #endif
 
 			nprocs++;
@@ -737,7 +737,7 @@ droptcb(struct tcb *tcp)
 
 #ifdef USE_LIBUNWIND
 	if (stack_trace_enabled) {
-		free_libunwind_ui(tcp);
+		unwind_tcb_fin(tcp);
 	}
 #endif
 	memset(tcp, 0, sizeof(*tcp));
@@ -1804,7 +1804,7 @@ init(int argc, char *argv[])
 
 #ifdef USE_LIBUNWIND
 	if (stack_trace_enabled)
-		init_unwind_addr_space();
+		unwind_init();
 #endif
 
 	if (!followfork)
diff --git a/syscall.c b/syscall.c
index 6575c3a..f2ade51 100644
--- a/syscall.c
+++ b/syscall.c
@@ -2709,7 +2709,7 @@ trace_syscall_exiting(struct tcb *tcp)
 
 #ifdef USE_LIBUNWIND
 	if (stack_trace_enabled)
-		print_stacktrace(tcp);
+		unwind_print_stacktrace(tcp);
 #endif
 
  ret:
diff --git a/unwind.c b/unwind.c
index fc97ea2..a2b9c6a 100644
--- a/unwind.c
+++ b/unwind.c
@@ -51,7 +51,7 @@ struct mmap_cache_t {
 static unw_addr_space_t libunwind_as;
 
 void
-init_unwind_addr_space(void)
+unwind_init(void)
 {
 	libunwind_as = unw_create_addr_space(&_UPT_accessors, 0);
 	if (!libunwind_as)
@@ -59,7 +59,7 @@ init_unwind_addr_space(void)
 }
 
 void
-init_libunwind_ui(struct tcb *tcp)
+unwind_tcb_init(struct tcb *tcp)
 {
 	tcp->libunwind_ui = _UPT_create(tcp->pid);
 	if (!tcp->libunwind_ui)
@@ -67,9 +67,9 @@ init_libunwind_ui(struct tcb *tcp)
 }
 
 void
-free_libunwind_ui(struct tcb *tcp)
+unwind_tcb_fin(struct tcb *tcp)
 {
-	delete_mmap_cache(tcp);
+	unwind_delete_mmap_cache(tcp);
 	_UPT_destroy(tcp->libunwind_ui);
 	tcp->libunwind_ui = NULL;
 }
@@ -157,7 +157,7 @@ alloc_mmap_cache(struct tcb* tcp)
 
 /* deleting the cache */
 void
-delete_mmap_cache(struct tcb* tcp)
+unwind_delete_mmap_cache(struct tcb* tcp)
 {
 	unsigned int i;
 	for (i = 0; i < tcp->mmap_cache_size; i++) {
@@ -171,7 +171,7 @@ delete_mmap_cache(struct tcb* tcp)
 
 /* use libunwind to unwind the stack and print a backtrace */
 void
-print_stacktrace(struct tcb* tcp)
+unwind_print_stacktrace(struct tcb* tcp)
 {
 	unw_word_t ip;
 	unw_cursor_t cursor;
-- 
1.9.0





More information about the Strace-devel mailing list