Linux-Trace-Devel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] trace-cmd: Have trace-cmd record -c set function-fork option if exists
@ 2020-03-02 18:03 Steven Rostedt
  0 siblings, 0 replies; only message in thread
From: Steven Rostedt @ 2020-03-02 18:03 UTC (permalink / raw)
  To: Linux Trace Devel


From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

If the function-fork option exists on the machine, then it should be set if
'-c' is added to trace-cmd record. Othrewise the function tracers will not
trace the children of the process it is recording.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 tracecmd/trace-record.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index 0a3851ad..2866b776 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -128,6 +128,7 @@ static int len_filter_pids;
 
 static int have_set_event_pid;
 static int have_event_fork;
+static int have_func_fork;
 
 struct opt_list {
 	struct opt_list *next;
@@ -354,6 +355,14 @@ static void test_set_event_pid(void)
 	}
 	tracefs_put_tracing_file(path);
 
+	path = tracefs_get_tracing_file("options/function-fork");
+	ret = stat(path, &st);
+	if (!ret) {
+		have_func_fork = 1;
+		reset_save_file(path, RESET_DEFAULT_PRIO);
+	}
+	tracefs_put_tracing_file(path);
+
 	tested = 1;
 }
 
@@ -5595,6 +5604,8 @@ static void parse_record_options(int argc,
 				save_option("event-fork");
 				ctx->do_child = 1;
 			}
+			if (have_func_fork)
+				save_option("function-fork");
 			break;
 		case 'C':
 			ctx->instance->clock = optarg;
-- 
2.20.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-02 18:03 [PATCH] trace-cmd: Have trace-cmd record -c set function-fork option if exists Steven Rostedt

Linux-Trace-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-trace-devel/0 linux-trace-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-trace-devel linux-trace-devel/ https://lore.kernel.org/linux-trace-devel \
		linux-trace-devel@vger.kernel.org
	public-inbox-index linux-trace-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-trace-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git