[CRIU] [PATCH 4/4] zdtm: fix struct tpacket_req3 redeclaration

Konstantin Khlebnikov khlebnikov at openvz.org
Wed Sep 12 03:48:47 EDT 2012


Linux has it since v3.2

cc -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -I../../lib   packet_sock.c ../../lib/libzdtmtst.a   -o packet_sock
packet_sock.c:70:8: error: redefinition of ‘struct tpacket_req3’
In file included from packet_sock.c:23:0:
/usr/include/linux/if_packet.h:245:8: note: originally defined here

Signed-off-by: Konstantin Khlebnikov <khlebnikov at openvz.org>
---
 test/zdtm/live/static/packet_sock.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/test/zdtm/live/static/packet_sock.c b/test/zdtm/live/static/packet_sock.c
index 3f13166..a12e624 100644
--- a/test/zdtm/live/static/packet_sock.c
+++ b/test/zdtm/live/static/packet_sock.c
@@ -20,6 +20,7 @@ const char *test_author = "Pavel Emelyanov <xemul at parallels.com>";
 #include <stdlib.h>
 #include <arpa/inet.h>
 #include <sys/socket.h>
+#include <linux/version.h>
 #include <linux/if_packet.h>
 #include <net/ethernet.h>
 
@@ -67,6 +68,8 @@ struct packet_mreq_max {
 
 #define LO_ADDR_LEN	6
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)
+
 struct tpacket_req3 {
 	unsigned int tp_block_size;
 	unsigned int tp_block_nr;
@@ -77,6 +80,8 @@ struct tpacket_req3 {
 	unsigned int tp_feature_req_word;
 };
 
+#endif
+
 int main(int argc, char **argv)
 {
 	int sk1, sk2;



More information about the CRIU mailing list