[kaffe] getifaddr for Linux 2.0.x (was: Patch queue status update)

Kiyo Inaba inaba@src.ricoh.co.jp
Fri May 30 19:24:01 2003


Hi,

> kiyo's getifaddr.c patch: unresolved.
It is discussed recently, and my idea is to detect the existence of
/usr/include/netpacket/packet.h. I attached a patch based on this
idea but I am not sure whether there are some system which
1) does not have 'getifaddrs'
and
2) linux based and have netpacket/packet.h.

At least RedHat 8.0 has 'getifaddrs' itself, and Linux 2.0.x (sorry
I can not specify exact version, but it is debian) does not have
either 'getifaddrs' or 'netpacket/packet.h'. If there are some system
which exactly match the criteria I mentioned, this patch is effective.

Kiyo

diff -Naur kaffe-snap-030515.orig/config/config.h.in kaffe-snap-030515/config/config.h.in
--- kaffe-snap-030515.orig/config/config.h.in	Wed May 21 20:10:47 2003
+++ kaffe-snap-030515/config/config.h.in	Fri May 30 19:33:39 2003
@@ -289,6 +289,9 @@
 /* Define to 1 if you have the <netinet/tcp.h> header file. */
 #undef HAVE_NETINET_TCP_H
 
+/* Define to 1 if you have the <netpacket/packet.h> header file. */
+#undef HAVE_NETPACKET_PACKET_H
+
 /* Define to 1 if you have the `on_exit' function. */
 #undef HAVE_ON_EXIT
 
diff -Naur kaffe-snap-030515.orig/configure kaffe-snap-030515/configure
--- kaffe-snap-030515.orig/configure	Wed May 21 20:18:20 2003
+++ kaffe-snap-030515/configure	Fri May 30 19:33:17 2003
@@ -23894,6 +23894,7 @@
 
 
 
+
 for ac_header in \
 alloca.h \
 asm/sigcontext.h asm/signal.h \
@@ -23914,6 +23915,7 @@
 netinet/in.h \
 netinet/in_systm.h \
 netinet/tcp.h \
+netpacket/packet.h \
 png.h \
 poll.h \
 pwd.h \
diff -Naur kaffe-snap-030515.orig/configure.in kaffe-snap-030515/configure.in
--- kaffe-snap-030515.orig/configure.in	Wed May 21 20:18:22 2003
+++ kaffe-snap-030515/configure.in	Fri May 30 19:33:17 2003
@@ -741,6 +741,7 @@
 netinet/in.h \
 netinet/in_systm.h \
 netinet/tcp.h \
+netpacket/packet.h \
 png.h \
 poll.h \
 pwd.h \
diff -Naur kaffe-snap-030515.orig/replace/getifaddrs.c kaffe-snap-030515/replace/getifaddrs.c
--- kaffe-snap-030515.orig/replace/getifaddrs.c	Fri Feb 21 18:51:11 2003
+++ kaffe-snap-030515/replace/getifaddrs.c	Sat May 31 03:59:03 2003
@@ -17,7 +17,7 @@
 
 #if defined(HAVE_GETIFADDRS)
 
-#elif defined(linux)
+#elif defined(linux) && defined(HAVE_NETPACKET_PACKET_H)
 
 #if !defined(__set_errno)
 #define __set_errno(x) errno = x