trace-cmd: A few fixes
cover trace-cmd: A few fixes
Some updates for trace-cmd
Steven Rostedt (VMware) (3):
trace-cmd: Fix leaking of port_array memory trace-cmd msg: Set the min size of a message on init trace-cmd TAGS: Fix tags to not parse .pc directory of patch
----
Makefile | 11 ++++++++--- trace-listen.c | 2 ++ trace-msg.c | 5 ++++- 3 files changed, 14 insertions(+), 4 deletions(-)
PATCH 1/3 trace-cmd: Fix leaking of port_array memory
From: "Steven Rostedt (VMware)" <[email protected]>
The port_array is allocated in create_all_readers() to send the ports that are created to the client. But after it is sent, it is no longer needed, but it was not freed. This causes a memory leak.
--- trace-listen.c | 2 ++ 1 file changed, 2 insertions(+)
trace-listen.c +2 -0
@@ -587,9 +587,11 @@ static int *create_all_readers(const char *node, const char *port,write (msg_handle->fd,"\0" ,1 ); } +free (port_array);return pid_array; out_free: +free (port_array);destroy_all_readers (cpus, pid_array, node, port);return NULL ; }
Signature · 1 line
2.13.2
PATCH 2/3 trace-cmd msg: Set the min size of a message on init
In reply to Steven RostedtFrom: "Steven Rostedt (VMware)" <[email protected]>
As there exist a map for the minimum sizes of messages, we can use that to set up the minimum size of messages during init of the msg_handle.
--- trace-msg.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
trace-msg.c +4 -1
@@ -255,7 +255,10 @@ static void tracecmd_msg_init(u32 cmd, struct tracecmd_msg *msg) {memset (msg,0 ,sizeof (*msg)); msg->hdr.cmd =htonl (cmd); - msg->hdr.size =htonl (MSG_HDR_LEN ); +if (!msg_min_sizes[cmd]) + msg->hdr.size =htonl (MSG_HDR_LEN ); +else + msg->hdr.size =htonl (msg_min_sizes[cmd]); }static void msg_free (struct tracecmd_msg *msg)
Signature · 1 line
2.13.2
PATCH 3/3 trace-cmd TAGS: Fix tags to not parse .pc directory of patch
In reply to Steven RostedtFrom: "Steven Rostedt (VMware)" <[email protected]>
When working on some code, I use quilt to develop to save off patchs to push and pop my current work. quilt will create a .pc directory to store the original files that are being worked on. Unfortunately, the current code that creates TAGS will decend into this directory and include it when doing code searching via emacs or vim. If one is not careful, they can end up editing the saved quilt original file and not the file they should be editing.
Add a find_tag_files define that limits the scope of where TAGS will get its code to examine.
--- Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
Makefile +8 -3
@@ -537,17 +537,22 @@ show_gui_done: PHONY += show_gui_make +define find_tag_files + find . -name '\.pc' -prune -o -name '*\.[ch]' \ + ! -name '\.#' -print +endef + tags: force $(RM) tags - find . -name '*.[ch]' | xargs ctags --extra=+f --c-kinds=+px + $(call find_tag_files) | xargs ctags --extra=+f --c-kinds=+px TAGS: force $(RM) TAGS - find . -name '*.[ch]' | xargs etags + $(call find_tag_files) | xargs etags cscope: force $(RM) cscope* - find . -name '*.[ch]' | cscope -b -q + $(call find_tag_files) | cscope -b -q PLUGINS_INSTALL = $(subst .so,.install,$(PLUGINS)) $(subst .so,.install,$(PYTHON_PLUGINS))
Signature · 1 line
2.13.2