[PATCH] libtracefs: Make comm field a string

Steven Rostedt <[email protected]> Wed, 27 Aug 2025 18:40:03 -0400
Newsgroups org.kernel.vger.linux-trace-devel
Message-ID <[email protected]>
From: "Steven Rostedt (Google)" <[email protected]>

The COMM or comm that is used in filtering and creating synthetic events is
a string, but it isn't defined as such when it is created. This limits how
creating synthetic events with COMM can work.

Without designating COMM as a string, the following:

  sqlhist -n hello select start.COMM from sched_switch as start where start.COMM = '"hello"'

Errors out with:

  Failed creating synthetic event!: Invalid argument
  select start.COMM from sched_switch as start where start.COMM = "hello"
         ^
  ERROR: 'start.COMM'
  Field 'COMM' is not compatible to be compared with the given value

Signed-off-by: Steven Rostedt (Google) <[email protected]>
---
 src/tracefs-filter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/tracefs-filter.c b/src/tracefs-filter.c
index 3b0933f..b7d050b 100644
--- a/src/tracefs-filter.c
+++ b/src/tracefs-filter.c
@@ -39,7 +39,7 @@ static const struct tep_format_field common_comm = {
 	.type			= "char",
 	.name			= "common_comm",
 	.size			= 4,
-	.flags			= TEP_FIELD_IS_ARRAY | TEP_FIELD_IS_DYNAMIC,
+	.flags			= TEP_FIELD_IS_ARRAY | TEP_FIELD_IS_DYNAMIC | TEP_FIELD_IS_STRING,
 };
 
 const struct tep_format_field tfs_common_stacktrace __hidden = {
-- 
2.47.2