From: Johannes Berg <johannes.berg@xxxxxxxxx> With Linux 6.17, having /sys/kernel/debug/tracing/ is now optional (CONFIG_TRACEFS_AUTOMOUNT_DEPRECATED), since tracefs has been around for a long time. Prefer tracefs when finding the trace_marker file. Note the "!buf[0]" condition which serves to keep the logic identical to before when tracefs isn't present, using the first debugfs rather than the last. That is not likely to matter, but still. Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx> --- src/utils/wpa_debug.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/utils/wpa_debug.c b/src/utils/wpa_debug.c index 7f3dd185f100..78686e5af1cd 100644 --- a/src/utils/wpa_debug.c +++ b/src/utils/wpa_debug.c @@ -130,7 +130,7 @@ int wpa_debug_open_linux_tracing(void) int mounts, trace_fd; char buf[4096] = {}; ssize_t buflen; - char *line, *tmp1, *path = NULL; + char *line, *tmp1; mounts = open("/proc/mounts", O_RDONLY); if (mounts < 0) { @@ -153,21 +153,31 @@ int wpa_debug_open_linux_tracing(void) strtok_r(line, " ", &tmp2); tmp_path = strtok_r(NULL, " ", &tmp2); fstype = strtok_r(NULL, " ", &tmp2); - if (fstype && strcmp(fstype, "debugfs") == 0) { - path = tmp_path; + + if (!buf[0] && fstype && strcmp(fstype, "debugfs") == 0) { + snprintf(buf, sizeof(buf) - 1, "%s/tracing/trace_marker", + tmp_path); + /* + * don't break to prefer tracefs, which if present may + * mean debugfs doesn't have tracing/ (depending on the + * kernel version) + */ + } + + if (fstype && strcmp(fstype, "tracefs") == 0) { + snprintf(buf, sizeof(buf) - 1, "%s/trace_marker", + tmp_path); break; } line = strtok_r(NULL, "\n", &tmp1); } - if (path == NULL) { - printf("debugfs mountpoint not found\n"); + if (!buf[0]) { + printf("tracefs/debugfs not found\n"); return -1; } - snprintf(buf, sizeof(buf) - 1, "%s/tracing/trace_marker", path); - trace_fd = open(buf, O_WRONLY); if (trace_fd < 0) { printf("failed to open trace_marker file\n"); -- 2.51.0 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap