[kaffe] libraries/clib/net/InetAddressImpl.c cannot be compiled on old Linux

Ito Kazumitsu ito.kazumitsu at hitachi-cable.co.jp
Thu Jun 12 21:06:01 PDT 2003


This is what I did to make kaffe 1.1.0 work with Linux 2.0.38.

1.  tar xzvf kaffe-1.1.0.tar.gz
    cd kaffe-1.1.0

2.  Copy from CVS files added or modified since the release of kaffe 1.1.0.

3.  Modify some programs (patch attached below).

    libraries/clib/net/InetAddressImpl.c.orig
    libraries/clib/net/NetworkInterfaceImpl.c.orig
    libraries/clib/net/PlainSocketImpl.c.orig
    include/getaddrinfo.h.orig
    include/dummyin6.h.orig

4.  ./configure

5.  make 'CFLAGS=-Din_port_t=int -g -O2 -Wall -Wstrict-prototypes'
                 ^^^^^^^^^^^^^^^
6.  make check

And I got:

================================
2 of 136 tests failed
(1 tests were not run)
Please report to kaffe at kaffe.org
================================

Those tests which failed were:

FAIL: DoublePrint.java
FAIL: Reflect.java

"FAIL: DoublePrint.java" is a expected result.
And  diff test/regression/Reflect.out test/regression/Reflect.fail is

19c19
< Method: public static native void java.lang.System.arraycopy(java.lang.Object,int,java.lang.Object,int,int)
---
> Method: public static void java.lang.System.arraycopy(java.lang.Object,int,java.lang.Object,int,int)

which is natural because I used the rt.jar that comes with kaffe 1.1.0
release.

And below is my patch.

--- libraries/clib/net/InetAddressImpl.c.orig	Fri Jun 13 09:01:20 2003
+++ libraries/clib/net/InetAddressImpl.c	Fri Jun 13 11:35:41 2003
@@ -54,7 +54,7 @@
 	case java_net_InetAddressImpl_INET_ADDRESS_V4:
 		retval = AF_INET;
 		break;
-#if defined(AF_INET6)
+#if defined(AF_INET6) && !defined(FAKE_INET6)
 	case java_net_InetAddressImpl_INET_ADDRESS_V6:
 		retval = AF_INET6;
 		break;
@@ -120,7 +120,7 @@
 				       sizeof(ia));
 			}
 		}
-#if defined(AF_INET6)
+#if defined(AF_INET6) && !defined(FAKE_INET6)
 		if( retval == NULL )
 		{
 			struct in6_addr ia;
@@ -182,7 +182,7 @@
 			switch( curr->ai_family )
 			{
 			case PF_INET:
-#if defined(PF_INET6)
+#if defined(PF_INET6) && !defined(FAKE_INET6)
 			case PF_INET6:
 #endif
 				count += 1;
@@ -196,7 +196,7 @@
 		curr = ai;
 		while( curr && retval )
 		{
-#if defined(PF_INET6)
+#if defined(PF_INET6) && !defined(FAKE_INET6)
 			struct sockaddr_in6 *in6;
 #endif
 			struct sockaddr_in *in4;
@@ -222,7 +222,7 @@
 					retval = 0;
 				}
 				break;
-#if defined(PF_INET6)
+#if defined(PF_INET6) && !defined(FAKE_INET6)
 			case PF_INET6:
 				in6 = (struct sockaddr_in6 *)
 					curr->ai_addr;
@@ -377,7 +377,7 @@
 {
 #if defined(HAVE_GETADDRINFO)
 	struct Hjava_lang_String *retval = 0;
-#if defined(AF_INET6)
+#if defined(AF_INET6) && !defined(FAKE_INET6)
 	struct sockaddr_in6 sa_buf;
 	struct sockaddr_in6 *sin6 = &sa_buf;
 #else
@@ -403,7 +403,7 @@
 		sin->sin_port = 0;
 		memcpy(&sin->sin_addr, unhand_byte_array(addr), addr->length);
 		break;
-#if defined(AF_INET6)
+#if defined(AF_INET6) && !defined(FAKE_INET6)
 	case 16:
 #if defined(BSD44)
 		sin6->sin6_len = sizeof(struct sockaddr_in6);
@@ -518,7 +518,7 @@
 	case 4:
 		family = AF_INET;
 		break;
-#if defined(AF_INET6)
+#if defined(AF_INET6) && !defined(FAKE_INET6)
 	case 16:
 		family = AF_INET6;
 		break;
--- libraries/clib/net/NetworkInterfaceImpl.c.orig	Fri Jun 13 09:02:13 2003
+++ libraries/clib/net/NetworkInterfaceImpl.c	Fri Jun 13 11:35:55 2003
@@ -133,7 +133,7 @@
 					  NII_MAX_ADDRESS_SIZE);
 				retval = stringC2Java(addr);
 				break;
-#if defined(AF_INET6)
+#if defined(AF_INET6) && !defined(FAKE_INET6)
 			case AF_INET6:
 				inet_ntop(sa->sa_family,
 					  &((struct sockaddr_in6 *)sa)->
--- libraries/clib/net/PlainSocketImpl.c.orig	Fri Jun 13 09:02:53 2003
+++ libraries/clib/net/PlainSocketImpl.c	Fri Jun 13 11:36:25 2003
@@ -322,7 +322,7 @@
 			       sizeof(addr.sin_addr));
 			break;
 
-#if notnow && defined(AF_INET6)
+#if notnow && defined(AF_INET6) && !defined(FAKE_INET6)
 		case AF_INET6:
 			remote_addr = (HArrayOfByte *)newArray(TYPE_CLASS(TYPE_Byte),
 							       sizeof(in6->sin6_addr));
--- include/getaddrinfo.h.orig	Fri Jun 13 08:49:18 2003
+++ include/getaddrinfo.h	Fri Jun 13 11:30:51 2003
@@ -137,6 +137,7 @@
 #define freeaddrinfo my_freeaddrinfo
 #define getaddrinfo my_getaddrinfo
 #define getnameinfo my_getnameinfo
+#define FAKE_INET6 1
 #endif
 
 /********************************************************************/
--- include/dummyin6.h.orig	Fri Jun 13 08:48:31 2003
+++ include/dummyin6.h	Fri Jun 13 11:48:15 2003
@@ -72,7 +72,9 @@
 struct sockaddr_in6 {
     sa_family_t sin6_family;
     in_port_t sin6_port;
+    int sin6_flowinfo;               /* fake */
     struct in6_addr sin6_addr;
+    int sin6_scope_id;               /* fake */
 };
 #endif
 




More information about the kaffe mailing list