OK, now I've actually tested that it builds.
On Thu, Oct 13, 2011 at 02:46:59PM -0700, Ben Pfaff wrote: > I tested it to this extent in the Xen DDK: > > blp@hardrock:~/xenddk-5.6.0$ sudo chroot . > [root@hardrock /]# cd > [root@hardrock ~]# cat > foo.c > #include <linux/types.h> > #include <sys/types.h> > [root@hardrock ~]# gcc foo.c > In file included from foo.c:2: > /usr/include/sys/types.h:62: error: conflicting types for 'dev_t' > /usr/include/linux/types.h:13: error: previous declaration of 'dev_t' was > here > /usr/include/sys/types.h:67: error: conflicting types for 'gid_t' > /usr/include/linux/types.h:27: error: previous declaration of 'gid_t' was > here > /usr/include/sys/types.h:72: error: conflicting types for 'mode_t' > /usr/include/linux/types.h:15: error: previous declaration of 'mode_t' > was here > /usr/include/sys/types.h:77: error: conflicting types for 'nlink_t' > /usr/include/linux/types.h:16: error: previous declaration of 'nlink_t' > was here > /usr/include/sys/types.h:82: error: conflicting types for 'uid_t' > /usr/include/linux/types.h:26: error: previous declaration of 'uid_t' was > here > In file included from /usr/include/sys/types.h:133, > from foo.c:2: > /usr/include/time.h:105: error: conflicting types for 'timer_t' > /usr/include/linux/types.h:22: error: previous declaration of 'timer_t' > was here > In file included from /usr/include/sys/types.h:220, > from foo.c:2: > /usr/include/sys/select.h:78: error: conflicting types for 'fd_set' > /usr/include/linux/types.h:12: error: previous declaration of 'fd_set' > was here > In file included from foo.c:2: > /usr/include/sys/types.h:235: error: conflicting types for 'blkcnt_t' > /usr/include/linux/types.h:114: error: previous declaration of 'blkcnt_t' > was here > [root@hardrock ~]# cat > foo.c > #include <sys/types.h> > #include <linux/types.h> > [root@hardrock ~]# gcc foo.c > /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o: In function > `_start': > (.text+0x18): undefined reference to `main' > collect2: ld returned 1 exit status > [root@hardrock ~]# exit > > On Thu, Oct 13, 2011 at 02:42:36PM -0700, Ethan Jackson wrote: > > This seems fine to me if assuming it fixes the errors. Jesse knows > > more about this sort of thing than I do so perhaps he should take a > > look. > > > > Ethan > > > > On Thu, Oct 13, 2011 at 14:38, Ben Pfaff <b...@nicira.com> wrote: > > > Avoids errors like the following: > > > > > > In file included from ./include/openvswitch/types.h:21, > > > ? ? ? ? ? ? ? ? from ./lib/vconn.h:21, > > > ? ? ? ? ? ? ? ? from tests/test-vconn.c:18: > > > /usr/include/sys/types.h:52: error: conflicting types for 'ino_t' > > > /usr/include/linux/types.h:14: error: previous declaration of 'ino_t' was > > > here > > > /usr/include/sys/types.h:62: error: conflicting types for 'dev_t' > > > /usr/include/linux/types.h:13: error: previous declaration of 'dev_t' was > > > here > > > /usr/include/sys/types.h:67: error: conflicting types for 'gid_t' > > > /usr/include/linux/types.h:27: error: previous declaration of 'gid_t' was > > > here > > > /usr/include/sys/types.h:72: error: conflicting types for 'mode_t' > > > /usr/include/linux/types.h:15: error: previous declaration of 'mode_t' > > > was here > > > /usr/include/sys/types.h:77: error: conflicting types for 'nlink_t' > > > /usr/include/linux/types.h:16: error: previous declaration of 'nlink_t' > > > was here > > > /usr/include/sys/types.h:82: error: conflicting types for 'uid_t' > > > /usr/include/linux/types.h:26: error: previous declaration of 'uid_t' was > > > here > > > /usr/include/sys/types.h:90: error: conflicting types for 'off_t' > > > /usr/include/linux/types.h:17: error: previous declaration of 'off_t' was > > > here > > > --- > > > ?include/linux/types.h | ? ?8 +++++++- > > > ?1 files changed, 7 insertions(+), 1 deletions(-) > > > > > > diff --git a/include/linux/types.h b/include/linux/types.h > > > index 4579add..13112e8 100644 > > > --- a/include/linux/types.h > > > +++ b/include/linux/types.h > > > @@ -23,7 +23,13 @@ > > > ?* <linux/types.h> to allow <linux/openvswitch.h> to work, that is, it > > > defines > > > ?* the __u<N> and __be<N> types. */ > > > > > > -#if __KERNEL__ || HAVE_LINUX_TYPES_H > > > +#ifdef __KERNEL__ > > > +#include_next <linux/types.h> > > > +#elif defined(HAVE_LINUX_TYPES_H) > > > +/* With some combinations of kernel and userspace headers, including both > > > + * <sys/types.h> and <linux/types.h> only works if you do so in that > > > order, so > > > + * force it. ?*/ > > > +#include <sys/types.h> > > > ?#include_next <linux/types.h> > > > ?#else ?/* no <linux/types.h> */ > > > ?#include <stdint.h> > > > -- > > > 1.7.4.4 > > > > > > _______________________________________________ > > > dev mailing list > > > dev@openvswitch.org > > > http://openvswitch.org/mailman/listinfo/dev > > > _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev