[PATCH] tests: Include linux/stat.h

Khem Raj raj.khem at gmail.com
Sat Aug 4 20:20:10 UTC 2018


Starting with glibc 2.28, sys/stat.h header will have the
definition for struct statx, in which case including  linux/stat.h should be
avoided, in order to prevent a duplicate definition.

Signed-off-by: Khem Raj <raj.khem at gmail.com>
---
 tests-m32/statx.c  | 7 +++++++
 tests-mx32/statx.c | 8 +++++++-
 tests/statx.c      | 8 +++++++-
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/tests-m32/statx.c b/tests-m32/statx.c
index 816b7eb..7364a02 100644
--- a/tests-m32/statx.c
+++ b/tests-m32/statx.c
@@ -30,6 +30,13 @@
 
 #ifdef __NR_statx
 
+# if defined(__GLIBC__)
+#  if !__GLIBC_PREREQ(2,28)
+#   include <linux/stat.h>
+#  endif
+# else
+#  include <linux/stat.h>
+# endif
 # include <linux/stat.h>
 # include "xlat.h"
 # include "xlat/statx_masks.h"
diff --git a/tests-mx32/statx.c b/tests-mx32/statx.c
index 816b7eb..e9f9993 100644
--- a/tests-mx32/statx.c
+++ b/tests-mx32/statx.c
@@ -30,7 +30,13 @@
 
 #ifdef __NR_statx
 
-# include <linux/stat.h>
+# if defined(__GLIBC__)
+#  if !__GLIBC_PREREQ(2,28)
+#   include <linux/stat.h>
+#  endif
+# else
+#  include <linux/stat.h>
+# endif
 # include "xlat.h"
 # include "xlat/statx_masks.h"
 # include "xlat/statx_attrs.h"
diff --git a/tests/statx.c b/tests/statx.c
index 816b7eb..e9f9993 100644
--- a/tests/statx.c
+++ b/tests/statx.c
@@ -30,7 +30,13 @@
 
 #ifdef __NR_statx
 
-# include <linux/stat.h>
+# if defined(__GLIBC__)
+#  if !__GLIBC_PREREQ(2,28)
+#   include <linux/stat.h>
+#  endif
+# else
+#  include <linux/stat.h>
+# endif
 # include "xlat.h"
 # include "xlat/statx_masks.h"
 # include "xlat/statx_attrs.h"
-- 
2.18.0



More information about the Strace-devel mailing list