[PATCH] Work around conflict between <{sys,linux}/ptrace.h>

Ali Polatel alip at exherbo.org
Tue Sep 24 17:04:32 UTC 2013


From: Ali Polatel <polatel at gmail.com>

From: Ali Polatel <alip at exherbo.org>

Since glibc 2.18 commit,
http://www.sourceware.org/git/?p=glibc.git;a=commit;h=521c6785e1fc94d1f501743e9a40af9e02797df3
<sys/ptrace.h> defines ptrace_peeksiginfo_args which collides with
<linux/ptrace.h>

* configure.ac: Check for `struct ptrace_peeksiginfo_args' in
<sys/ptrace.h>
* signal.c, syscall.c, process.c, util.c: Work around conflicts between
<sys/ptrace.h> and <linux/ptrace.h> for redefining those types.

Signed-off-by: Ali Polatel <alip at exherbo.org>
---
 configure.ac | 2 +-
 process.c    | 4 ++++
 signal.c     | 4 ++++
 syscall.c    | 4 ++++
 util.c       | 4 ++++
 5 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index f19e4f2..aa4923a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -257,7 +257,7 @@ AC_CHECK_MEMBERS([struct T_conn_res.QUEUE_ptr,
 
 AC_CHECK_TYPES([struct __old_kernel_stat],,, [#include <asm/stat.h>])
 
-AC_CHECK_TYPES([struct pt_all_user_regs, struct ia64_fpreg],,,
+AC_CHECK_TYPES([struct pt_all_user_regs, struct ia64_fpreg, struct ptrace_peeksiginfo_args],,,
 	       [#include <sys/ptrace.h>])
 
 AC_CHECK_TYPES([struct user_desc],,, [#include <asm/ldt.h>])
diff --git a/process.c b/process.c
index 1a2181b..59428a4 100644
--- a/process.c
+++ b/process.c
@@ -63,7 +63,11 @@
 # ifdef HAVE_STRUCT_PT_ALL_USER_REGS
 #  define pt_all_user_regs XXX_pt_all_user_regs
 # endif
+# ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
+#  define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args
+# endif
 # include <linux/ptrace.h>
+# undef ptrace_peeksiginfo_args
 # undef ia64_fpreg
 # undef pt_all_user_regs
 #endif
diff --git a/signal.c b/signal.c
index 7fb9abf..569a0fd 100644
--- a/signal.c
+++ b/signal.c
@@ -51,6 +51,10 @@
 # ifdef HAVE_STRUCT_PT_ALL_USER_REGS
 #  define pt_all_user_regs XXX_pt_all_user_regs
 # endif
+# ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
+#  define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args
+# endif
+# undef ptrace_peeksiginfo_args
 # include <linux/ptrace.h>
 # undef ia64_fpreg
 # undef pt_all_user_regs
diff --git a/syscall.c b/syscall.c
index 83a95bd..3477dcd 100644
--- a/syscall.c
+++ b/syscall.c
@@ -48,7 +48,11 @@
 # ifdef HAVE_STRUCT_PT_ALL_USER_REGS
 #  define pt_all_user_regs XXX_pt_all_user_regs
 # endif
+# ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
+#  define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args
+# endif
 # include <linux/ptrace.h>
+# undef ptrace_peeksiginfo_args
 # undef ia64_fpreg
 # undef pt_all_user_regs
 #endif
diff --git a/util.c b/util.c
index 0dab902..30a7f19 100644
--- a/util.c
+++ b/util.c
@@ -55,7 +55,11 @@
 # ifdef HAVE_STRUCT_PT_ALL_USER_REGS
 #  define pt_all_user_regs XXX_pt_all_user_regs
 # endif
+# ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
+#  define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args
+# endif
 # include <linux/ptrace.h>
+# undef ptrace_peeksiginfo_args
 # undef ia64_fpreg
 # undef pt_all_user_regs
 #endif
-- 
1.8.4





More information about the Strace-devel mailing list