From: "Steven Rostedt (VMware)" <rostedt@xxxxxxxxxxx> When using libtracefs in a program, Adding the following: #define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> #include <string.h> #include <tracefs.h> Caused the following error: In file included from /usr/include/bits/statx.h:31, from /usr/include/sys/stat.h:446, from /usr/local/include/tracefs/tracefs.h:9, /usr/include/linux/stat.h:57:2: error: unknown type name â__s64â 57 | __s64 tv_sec; | ^~~~~ The #define _GNU_SOURCE appears to cause this, but I needed it for my program. I tried several combinations to fix it, but the only solution I found that worked was to remove <sys/stat.h> from tracefs.h. There's no reason to have it in the global header. The only includes that a header should have are those that the header itself needed. As tracefs.h does not need sys/stat.h itself, it should be removed. Fixes: 4b05ae03 ("libtracefs: Add missing system includes") Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx> --- include/tracefs.h | 1 - src/tracefs-tools.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/include/tracefs.h b/include/tracefs.h index 55f8239..0e31a4f 100644 --- a/include/tracefs.h +++ b/include/tracefs.h @@ -6,7 +6,6 @@ #ifndef _TRACE_FS_H #define _TRACE_FS_H -#include <sys/stat.h> #include <fcntl.h> #include <sched.h> #include <event-parse.h> diff --git a/src/tracefs-tools.c b/src/tracefs-tools.c index ca0ed58..ae85444 100644 --- a/src/tracefs-tools.c +++ b/src/tracefs-tools.c @@ -11,6 +11,7 @@ #include <unistd.h> #include <fcntl.h> #include <sys/types.h> +#include <sys/stat.h> #include <regex.h> #include <dirent.h> #include <limits.h> -- 2.31.1