From 13949bb2930bf3cc09db5ecd3e46fd36d0ba84e9 Mon Sep 17 00:00:00 2001 From: Florian Pose <fp@igh-essen.com> Date: Mon, 25 Oct 2010 16:45:33 +0200 Subject: [PATCH] Improved compiling on 2.6.34 (thanks to Malcolm Lewis). --- examples/mini/mini.c | 4 ++++ examples/tty/serial.c | 1 + lib/Makefile.am | 2 +- lib/common.c | 2 ++ lib/master.c | 1 + master/foe_request.c | 1 + master/sdo_request.c | 1 + master/soe_request.c | 1 + tool/Makefile.am | 3 ++- tty/module.c | 1 + 10 files changed, 15 insertions(+), 2 deletions(-) diff --git a/examples/mini/mini.c b/examples/mini/mini.c index 1e1a6eba..eaa71b2e 100644 --- a/examples/mini/mini.c +++ b/examples/mini/mini.c @@ -33,6 +33,10 @@ #include <linux/interrupt.h> #include <linux/err.h> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34) +#include <linux/slab.h> +#endif + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) #include <linux/semaphore.h> #else diff --git a/examples/tty/serial.c b/examples/tty/serial.c index 63cf7c2c..a7f68a0f 100644 --- a/examples/tty/serial.c +++ b/examples/tty/serial.c @@ -30,6 +30,7 @@ #include <linux/module.h> #include <linux/err.h> #include <linux/termios.h> +#include <linux/slab.h> #include "../../include/ecrt.h" // EtherCAT realtime interface #include "../../include/ectty.h" // EtherCAT TTY interface diff --git a/lib/Makefile.am b/lib/Makefile.am index 9aafce4c..5de48cc1 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -35,7 +35,7 @@ lib_LTLIBRARIES = libethercat.la #------------------------------------------------------------------------------ libethercat_la_LDFLAGS = -version-info 1:0:0 -libethercat_la_CFLAGS = -I$(srcdir)/.. +libethercat_la_CFLAGS = -I$(srcdir)/.. -fno-strict-aliasing libethercat_la_SOURCES = \ common.c \ domain.c \ diff --git a/lib/common.c b/lib/common.c index 35702376..f1e146c2 100644 --- a/lib/common.c +++ b/lib/common.c @@ -37,6 +37,8 @@ #include <string.h> #include <sys/ioctl.h> #include <sys/mman.h> +#include <unistd.h> +#include <sys/socket.h> #include "master.h" #include "master/ioctl.h" diff --git a/lib/master.c b/lib/master.c index d446bfc8..3ad0b063 100644 --- a/lib/master.c +++ b/lib/master.c @@ -49,6 +49,7 @@ int ecrt_master_reserve(ec_master_t *master) strerror(errno)); return -1; } + return 0; } /*****************************************************************************/ diff --git a/master/foe_request.c b/master/foe_request.c index 35815720..822d3cac 100644 --- a/master/foe_request.c +++ b/master/foe_request.c @@ -35,6 +35,7 @@ #include <linux/module.h> #include <linux/jiffies.h> +#include <linux/slab.h> #include "foe_request.h" #include "foe.h" diff --git a/master/sdo_request.c b/master/sdo_request.c index ae981945..b167826d 100644 --- a/master/sdo_request.c +++ b/master/sdo_request.c @@ -35,6 +35,7 @@ #include <linux/module.h> #include <linux/jiffies.h> +#include <linux/slab.h> #include "sdo_request.h" diff --git a/master/soe_request.c b/master/soe_request.c index b2fe0716..3ac67171 100644 --- a/master/soe_request.c +++ b/master/soe_request.c @@ -35,6 +35,7 @@ #include <linux/module.h> #include <linux/jiffies.h> +#include <linux/slab.h> #include "soe_request.h" diff --git a/tool/Makefile.am b/tool/Makefile.am index cdbce03a..412662eb 100644 --- a/tool/Makefile.am +++ b/tool/Makefile.am @@ -128,6 +128,7 @@ REV = `if test -s $(top_srcdir)/revision; then \ ethercat_CXXFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/master \ - -Wall -DREV=$(REV) + -Wall -DREV=$(REV) \ + -fno-strict-aliasing #------------------------------------------------------------------------------ diff --git a/tty/module.c b/tty/module.c index b118ca3a..6f5d6c15 100644 --- a/tty/module.c +++ b/tty/module.c @@ -43,6 +43,7 @@ #include <linux/version.h> #include <linux/serial.h> #include <linux/uaccess.h> +#include <linux/slab.h> #include "../master/globals.h" #include "../include/ectty.h" -- GitLab