[PATCH] libtracefs: Have tracefs_instance_tracers() return instance tracers

Steven Rostedt <[email protected]>
Newsgroups org.kernel.vger.linux-trace-devel
Message-ID <[email protected]>
From: "Steven Rostedt (Google)" <[email protected]>

The tracefs_instance_tracers() was always returning the top level tracers
and not the tracers that were available for the given instance.

Fixes: 185019c0 ("libtracefs: Add tracefs_instance_tracers() API")
Signed-off-by: Steven Rostedt (Google) <[email protected]>
---
 src/tracefs-events.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/tracefs-events.c b/src/tracefs-events.c
index 83069aa..77d1ba8 100644
--- a/src/tracefs-events.c
+++ b/src/tracefs-events.c
@@ -1012,12 +1012,20 @@ char **tracefs_tracers(const char *tracing_dir)
  */
 char **tracefs_instance_tracers(struct tracefs_instance *instance)
 {
-	const char *tracing_dir = NULL;
+	char *tracing_dir = NULL;
+	char **list;
+	int ret;
 
-	if (instance)
-		tracing_dir = instance->trace_dir;
+	if (instance) {
+		ret = asprintf(&tracing_dir, "%s/instances/%s", instance->trace_dir,
+			       instance->name);
+		if (ret < 0)
+			return NULL;
+	}
 
-	return list_tracers(tracing_dir);
+	list = list_tracers(tracing_dir);
+	free(tracing_dir);
+	return list;
 }
 
 static int load_events(struct tep_handle *tep,
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.