On mån, 2007-01-29 at 08:43 +0100, Magnus Fromreide wrote:
> On Sat, Jan 27, 2007 at 03:31:25PM +0100, Thomas Anders wrote:
> > Thomas Anders wrote:
> > > Magnus Fromreide wrote:
> > >> Further checking shows that <linux/types.h> showed up between 1.0.9 and
> > >> 1.2.13 while <linux/ethtool.h> showed up between 2.2.26 and 2.4.18 so if
> > >> ethtool.h exists then types.h also exists.
> > >> types.h have always declared the __uN versions.
> > >>
> > >> Thus the attached patch should work for all versions (Tested on kernel
> > >> 2.6.18.6, if someone could test it on older versions as well then that
> > >> would be nice)
> > > 
> > > Committed to 5.[234].x CVS and CVS MAIN. Thanks for the patch.
> > 
> > Unfortunately this patch seems to break my CVS MAIN build on RH9 (2.4.20):
> 
> That's bad - could you please privately send the preprocessed file that
> generated the warnings you saw?

Thanks for the files - it was just what I needed.

The problem is that glibc in that version is broken.

<sys/sysctl.h> unconditionally defines _LINUX_TYPES_H and thus prevents
the definition of the symbol that I used since <sys/sysctl.h> is
included through "mibII/mibII_common.h" before I get to include
<linux/types.h>

The easiest fix would be to change the order of inclusions in the
affected file, see the attached patch. Of course the inclusion order
could be different from that as well if there are reasons for that.

/MF

> In the version I have seen of ethtool.h from 2.4.20 autoneg doesn't show up
> before line 26 and there are other similar declarations before it.
> 
> > /usr/include/linux/ethtool.h:23: parse error before "autoneg"
> > /usr/include/linux/ethtool.h:24: parse error before "maxtxpkt"
> > /usr/include/linux/ethtool.h:25: parse error before "maxrxpkt"
> > /usr/include/linux/ethtool.h:26: parse error before "reserved"
> > /usr/include/linux/ethtool.h:27: parse error before '}' token
> > /usr/include/linux/ethtool.h:32: parse error before "u32"
> > /usr/include/linux/ethtool.h:40: parse error before "eedump_len"
> > /usr/include/linux/ethtool.h:41: parse error before "regdump_len"
> > /usr/include/linux/ethtool.h:47: parse error before "u32"
> > /usr/include/linux/ethtool.h:49: parse error before "wolopts"
> > /usr/include/linux/ethtool.h:50: parse error before "sopass"
> > /usr/include/linux/ethtool.h:51: parse error before '}' token
> > /usr/include/linux/ethtool.h:55: parse error before "u32"
> > /usr/include/linux/ethtool.h:61: parse error before "u32"
> > /usr/include/linux/ethtool.h:63: parse error before "len"
> > /usr/include/linux/ethtool.h:64: parse error before "data"
> > /usr/include/linux/ethtool.h:65: parse error before '}' token
> > /usr/include/linux/ethtool.h:69: parse error before "u32"
> > /usr/include/linux/ethtool.h:71: parse error before "offset"
> > /usr/include/linux/ethtool.h:72: parse error before "len"
> > /usr/include/linux/ethtool.h:73: parse error before "data"
> > /usr/include/linux/ethtool.h:74: parse error before '}' token
> > make[2]: *** [if-mib/data_access/interface_linux.lo] Error 1
> > 
> > I haven't done any investigation yet.
> > 
> > 
> > +Thomas
> > 
> > -- 
> > Thomas Anders (thomas.anders at blue-cable.de)
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Net-snmp-coders mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
Index: clean/agent/mibgroup/if-mib/data_access/interface_linux.c
===================================================================
--- clean.orig/agent/mibgroup/if-mib/data_access/interface_linux.c	2007-01-29 22:19:33.000000000 +0100
+++ clean/agent/mibgroup/if-mib/data_access/interface_linux.c	2007-01-29 22:19:52.000000000 +0100
@@ -5,6 +5,16 @@
  */
 #include <net-snmp/net-snmp-config.h>
 #include <net-snmp/net-snmp-includes.h>
+
+#ifdef HAVE_LINUX_ETHTOOL_H
+#include <linux/types.h>
+typedef __u64 u64;         /* hack, so we may include kernel's ethtool.h */
+typedef __u32 u32;         /* ditto */
+typedef __u16 u16;         /* ditto */
+typedef __u8 u8;           /* ditto */
+#include <linux/ethtool.h>
+#endif /* HAVE_LINUX_ETHTOOL_H */
+
 #include "mibII/mibII_common.h"
 #include "if-mib/ifTable/ifTable_constants.h"
 
@@ -25,14 +35,6 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
-#ifdef HAVE_LINUX_ETHTOOL_H
-#include <linux/types.h>
-typedef __u64 u64;         /* hack, so we may include kernel's ethtool.h */
-typedef __u32 u32;         /* ditto */
-typedef __u16 u16;         /* ditto */
-typedef __u8 u8;           /* ditto */
-#include <linux/ethtool.h>
-#endif /* HAVE_LINUX_ETHTOOL_H */
 #include <linux/sockios.h>
 
 unsigned int
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to