Since glibc-2.18, the struct ptrace_peeksiginfo_args is
also defined in sys/ptrace.h and conflicts with the definition
from the Linux kernel in linux/ptrace.h. We fix this by not
including the linux/ptrace.h header if the sys/ptrace.h header
defines the said struct. Fixes
https://github.com/linux-test-project/ltp/issues/6

Signed-off-by: Markos Chandras <[email protected]>
---
Build tested on glibc-2.17 and glibc-2.18 systems

Changes since v1:
Comments: http://sourceforge.net/mailarchive/message.php?msg_id=31677254
- Move the AC_CHECK_TYPES from configure.ac to m4/ltp-ptrace.m4
- Fix typo in config.h.default
---
 include/config.h.default                  | 3 +++
 m4/ltp-ptrace.m4                          | 3 +++
 testcases/kernel/syscalls/ptrace/ptrace.h | 4 +++-
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/include/config.h.default b/include/config.h.default
index 96e25c4..7095b92 100644
--- a/include/config.h.default
+++ b/include/config.h.default
@@ -167,6 +167,9 @@
 /* Define to 1 if the system has the type `struct modify_ldt_ldt_s'. */
 #undef HAVE_STRUCT_MODIFY_LDT_LDT_S
 
+/* Define to 1 if the system has the type `struct ptrace_peeksiginfo_args'. */
+#undef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
+
 /* Define to 1 if `signo' is member of `struct signalfd_siginfo'. */
 #undef HAVE_STRUCT_SIGNALFD_SIGINFO_SIGNO
 
diff --git a/m4/ltp-ptrace.m4 b/m4/ltp-ptrace.m4
index 63e968e..ca360bb 100644
--- a/m4/ltp-ptrace.m4
+++ b/m4/ltp-ptrace.m4
@@ -40,5 +40,8 @@ save_CPPFLAGS=$CPPFLAGS
 CPPFLAGS="$CPPFLAGS -I$srcdir/testcases/kernel/syscalls/ptrace"
 AC_CHECK_TYPES([struct user_regs_struct, struct pt_regs],,,[#include 
"ptrace.h"])
 AC_CHECK_DECLS([PTRACE_GETSIGINFO, PTRACE_O_TRACEVFORKDONE, 
PTRACE_SETOPTIONS],,,[#include "ptrace.h"])
+dnl glibc-2.18 defines ptrace_peeksiginfo_args in sys/ptrace.h which
+dnl conflicts with the one from linux kernel in linux/ptrace.h
+AC_CHECK_TYPES([struct ptrace_peeksiginfo_args],,,[#include <sys/ptrace.h>])
 CPPFLAGS=$save_CPPFLAGS
 ])
diff --git a/testcases/kernel/syscalls/ptrace/ptrace.h 
b/testcases/kernel/syscalls/ptrace/ptrace.h
index f0767d7..4a43f01 100644
--- a/testcases/kernel/syscalls/ptrace/ptrace.h
+++ b/testcases/kernel/syscalls/ptrace/ptrace.h
@@ -19,7 +19,9 @@
 # include <asm/ptrace.h>
 #endif
 #ifdef HAVE_LINUX_PTRACE_H
-# include <linux/ptrace.h>
+# ifndef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
+#  include <linux/ptrace.h>
+# endif
 #endif
 #undef FU_ia64_fpreg
 #undef FU_pt_all_user_regs
-- 
1.8.4.4



------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to