[CRIU] [PATCH] make: config add test for ptrace_peeksiginfo_args

Andrey Vagin avagin at openvz.org
Mon Feb 3 06:40:00 PST 2014


Currently we check PTRACE_PEEKSIGINFO and if it's defined in a system
header, we suppose that ptrace_peeksiginfo_args is defined there too.

But due to a bug in glibc, this check doesn't work. Now we have F20,
where ptrace_peeksiginfo_args is defined in sys/ptrace and F21 where
it isn't defined.

commit 9341dde4d56ca71b61b47c8b87a06e6d5813ed0e
Author: Mike Frysinger <vapier at gentoo.org>
Date:   Sun Jan 5 16:07:13 2014 -0500

    ptrace.h: add __ prefix to ptrace_peeksiginfo_args

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 Makefile.config           |  3 +++
 include/ptrace.h          |  9 ++++++---
 scripts/feature-tests.mak | 13 +++++++++++++
 3 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/Makefile.config b/Makefile.config
index 4c074a7..edd110a 100644
--- a/Makefile.config
+++ b/Makefile.config
@@ -19,6 +19,9 @@ endif
 ifeq ($(call try-cc,$(STRLCAT_TEST),,),y)
 	$(Q) @echo '#define CONFIG_HAS_STRLCAT' >> $@
 endif
+ifeq ($(call try-cc,$(PTRACE_PEEKSIGINFO_TEST),,),y)
+	$(Q) @echo '#define CONFIG_HAS_PEEKSIGINFO_ARGS' >> $@
+endif
 	$(Q) @echo '#endif /* __CR_CONFIG_H__ */' >> $@
 
 config: $(CONFIG)
diff --git a/include/ptrace.h b/include/ptrace.h
index 46b6def..15a56c7 100644
--- a/include/ptrace.h
+++ b/include/ptrace.h
@@ -19,14 +19,17 @@
 
 #ifndef PTRACE_PEEKSIGINFO
 #define PTRACE_PEEKSIGINFO      0x4209
+
+/* Read signals from a shared (process wide) queue */
+#define PTRACE_PEEKSIGINFO_SHARED       (1 << 0)
+#endif
+
+#ifndef CONFIG_HAS_PEEKSIGINFO_ARGS
 struct ptrace_peeksiginfo_args {
         __u64 off;	/* from which siginfo to start */
         __u32 flags;
         __u32 nr;	/* how may siginfos to take */
 };
-
-/* Read signals from a shared (process wide) queue */
-#define PTRACE_PEEKSIGINFO_SHARED       (1 << 0)
 #endif
 
 #ifndef PTRACE_GETREGSET
diff --git a/scripts/feature-tests.mak b/scripts/feature-tests.mak
index 61e68ad..be65dfa 100644
--- a/scripts/feature-tests.mak
+++ b/scripts/feature-tests.mak
@@ -55,3 +55,16 @@ int main(void)
 	return strlcat(dst, src, sizeof(dst));
 }
 endef
+
+define PTRACE_PEEKSIGINFO_TEST
+
+#include <sys/ptrace.h>
+
+int main(void)
+{
+	struct ptrace_peeksiginfo_args args = {};
+
+	return 0;
+}
+
+endef
-- 
1.8.5.3



More information about the CRIU mailing list