@@ -6,6 +6,7 @@
#include <linux/types.h>
#include <linux/limits.h>
#include <linux/bpf.h>
+#include <linux/sched/task.h>
#include <sys/types.h> /* pid_t */
#define event_contains(obj, mem) ((obj).header.size > offsetof(typeof(obj), mem))
@@ -47,7 +48,7 @@ struct perf_record_mmap2 {
struct perf_record_comm {
struct perf_event_header header;
__u32 pid, tid;
- char comm[16];
+ char comm[TASK_COMM_LEN_16];
};
struct perf_record_namespaces {
@@ -291,7 +292,7 @@ struct perf_record_itrace_start {
struct perf_record_thread_map_entry {
__u64 pid;
- char comm[16];
+ char comm[TASK_COMM_LEN_16];
};
struct perf_record_thread_map {
Use TASK_COMM_LEN_16 instead of hard-coded 16 to make it more grepable. The comm is set in perf_event__prepare_comm(), which makes the comm always a nul terminated string, so we don't worry about whether it will be truncated or not. Signed-off-by: Yafang Shao <laoar.shao@gmail.com> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Kees Cook <keescook@chromium.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Petr Mladek <pmladek@suse.com> --- tools/lib/perf/include/perf/event.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)