diff options
author | Robert Schuster <thebohemian@gmx.net> | 2008-04-22 17:24:52 +0000 |
---|---|---|
committer | Robert Schuster <thebohemian@gmx.net> | 2008-04-22 17:24:52 +0000 |
commit | 01104c369934b4da8a6696f2e3b864da846bd070 (patch) | |
tree | 3c0bcf51452fa3a03515a85d20ec6748ea0110c7 | |
parent | 0642c1cb7630962febdb247ea253c69ab430d568 (diff) | |
parent | 5bbd957ace4e196d6a4b1719064b504182bdba08 (diff) |
merge of '20025d89729fe0a6767a43dd3f3c675b5aebdcf4'
and '2408f9a34a6c104a87d3c509f505466900bccedb'
-rw-r--r-- | packages/classpath/classpath-minimal_0.97.1.bb | 7 | ||||
-rw-r--r-- | packages/classpath/classpath_0.97.1.bb | 8 | ||||
-rw-r--r-- | packages/classpath/files/SimpleName.diff | 66 | ||||
-rw-r--r-- | packages/classpath/files/netif_16.patch | 263 |
4 files changed, 341 insertions, 3 deletions
diff --git a/packages/classpath/classpath-minimal_0.97.1.bb b/packages/classpath/classpath-minimal_0.97.1.bb index 31abce59c7..131dc3fac5 100644 --- a/packages/classpath/classpath-minimal_0.97.1.bb +++ b/packages/classpath/classpath-minimal_0.97.1.bb @@ -1,6 +1,11 @@ require classpath.inc -PR = "r0" +SRC_URI += "\ + file://netif_16.patch;patch=1;pnum=0 \ + file://SimpleName.diff;patch=1;pnum=0 \ + " + +PR = "r1" PROVIDES = "${PN} classpath" diff --git a/packages/classpath/classpath_0.97.1.bb b/packages/classpath/classpath_0.97.1.bb index b8cd02084a..1d677687d7 100644 --- a/packages/classpath/classpath_0.97.1.bb +++ b/packages/classpath/classpath_0.97.1.bb @@ -1,6 +1,11 @@ require classpath.inc -PR = "r0" +SRC_URI += "\ + file://netif_16.patch;patch=1;pnum=0 \ + file://SimpleName.diff;patch=1;pnum=0 \ + " + +PR = "r1" DEPENDS += "gtk+ gconf libxtst" @@ -15,4 +20,3 @@ EXTRA_OECONF += "\ --with-vm=java \ " - diff --git a/packages/classpath/files/SimpleName.diff b/packages/classpath/files/SimpleName.diff new file mode 100644 index 0000000000..ff2bec0f1c --- /dev/null +++ b/packages/classpath/files/SimpleName.diff @@ -0,0 +1,66 @@ +Index: vm/reference/java/lang/VMClass.java +=================================================================== +RCS file: /sources/classpath/classpath/vm/reference/java/lang/VMClass.java,v +retrieving revision 1.20 +diff -u -r1.20 VMClass.java +--- vm/reference/java/lang/VMClass.java 18 Sep 2007 21:52:38 -0000 1.20 ++++ vm/reference/java/lang/VMClass.java 19 Apr 2008 15:19:00 -0000 +@@ -296,27 +296,43 @@ + */ + static String getSimpleName(Class klass) + { ++ int arrayCount = 0; ++ while (klass.isArray()) ++ { ++ klass = klass.getComponentType(); ++ ++arrayCount; ++ } ++ // now klass is the component type ++ ++ String simpleComponentName = null; + if (isAnonymousClass(klass)) +- return ""; +- if (isArray(klass)) + { +- return getComponentType(klass).getSimpleName() + "[]"; ++ simpleComponentName = ""; + } +- String fullName = getName(klass); +- int pos = fullName.lastIndexOf("$"); +- if (pos == -1) +- pos = 0; + else + { +- ++pos; +- while (Character.isDigit(fullName.charAt(pos))) +- ++pos; ++ String fullName = getName(klass); ++ int pos = fullName.lastIndexOf("$"); ++ if (pos != -1) ++ { //inner class or local class ++ // skip digits of local classes ++ while (Character.isDigit(fullName.charAt(pos+1))) ++ pos++; ++ } ++ else ++ { ++ pos = fullName.lastIndexOf("."); ++ } ++ simpleComponentName = fullName.substring(pos+1); + } +- int packagePos = fullName.lastIndexOf(".", pos); +- if (packagePos == -1) +- return fullName.substring(pos); +- else +- return fullName.substring(packagePos + 1); ++ ++ if (arrayCount == 0) ++ return simpleComponentName; ++ ++ StringBuffer sb = new StringBuffer(simpleComponentName); ++ while (arrayCount-- > 0) ++ sb.append("[]"); ++ return sb.toString(); + } + + /** diff --git a/packages/classpath/files/netif_16.patch b/packages/classpath/files/netif_16.patch new file mode 100644 index 0000000000..9b5e425ee9 --- /dev/null +++ b/packages/classpath/files/netif_16.patch @@ -0,0 +1,263 @@ +Index: java/net/NetworkInterface.java +=================================================================== +RCS file: /sources/classpath/classpath/java/net/NetworkInterface.java,v +retrieving revision 1.23 +diff -u -r1.23 NetworkInterface.java +--- java/net/NetworkInterface.java 18 Dec 2006 21:37:39 -0000 1.23 ++++ java/net/NetworkInterface.java 21 Apr 2008 10:38:25 -0000 +@@ -1,5 +1,5 @@ + /* NetworkInterface.java -- +- Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. ++ Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008 Free Software Foundation, Inc. + + This file is part of GNU Classpath. + +@@ -265,4 +265,50 @@ + + return result.toString(); + } ++ ++ /** ++ * Determines whether this interface is ready to transfer data. ++ * ++ * @return whether the interface is up ++ */ ++ public boolean isUp() ++ throws SocketException ++ { ++ return VMNetworkInterface.isUp(netif.name); ++ } ++ ++ /** ++ * Determines whether this interface does point to point ++ * transmission. ++ * ++ * @return whether the interface does point to point transmission ++ */ ++ public boolean isPointToPoint() ++ throws SocketException ++ { ++ return VMNetworkInterface.isPointToPoint(netif.name); ++ } ++ ++ /** ++ * Determines whether this interface is the loopback interface. ++ * ++ * @return whether the interface is the loopback interface ++ */ ++ public boolean isLoopback() ++ throws SocketException ++ { ++ return VMNetworkInterface.isLoopback(netif.name); ++ } ++ ++ /** ++ * Determines whether this interface supports multicast transmission. ++ * ++ * @return whether the interface supports multicast transmission. ++ */ ++ public boolean supportsMulticast() ++ throws SocketException ++ { ++ return VMNetworkInterface.supportsMulticast(netif.name); ++ } ++ + } +Index: vm/reference/java/net/VMNetworkInterface.java +=================================================================== +RCS file: /sources/classpath/classpath/vm/reference/java/net/VMNetworkInterface.java,v +retrieving revision 1.7 +diff -u -r1.7 VMNetworkInterface.java +--- vm/reference/java/net/VMNetworkInterface.java 18 Dec 2006 21:37:39 -0000 1.7 ++++ vm/reference/java/net/VMNetworkInterface.java 21 Apr 2008 10:38:25 -0000 +@@ -1,5 +1,5 @@ + /* VMNetworkInterface.java -- +- Copyright (C) 2005 Free Software Foundation, Inc. ++ Copyright (C) 2005, 2008 Free Software Foundation, Inc. + + This file is part of GNU Classpath. + +@@ -119,4 +119,13 @@ + else + throw new SocketException("invalid interface address"); + } ++ ++ static native boolean isUp(String name) throws SocketException; ++ ++ static native boolean isLoopback(String name) throws SocketException; ++ ++ static native boolean isPointToPoint(String name) throws SocketException; ++ ++ static native boolean supportsMulticast(String name) throws SocketException; ++ + } +Index: native/jni/java-net/java_net_VMNetworkInterface.c +=================================================================== +RCS file: /sources/classpath/classpath/native/jni/java-net/java_net_VMNetworkInterface.c,v +retrieving revision 1.6 +diff -u -r1.6 java_net_VMNetworkInterface.c +--- native/jni/java-net/java_net_VMNetworkInterface.c 5 Apr 2007 12:34:19 -0000 1.6 ++++ native/jni/java-net/java_net_VMNetworkInterface.c 21 Apr 2008 10:38:25 -0000 +@@ -1,5 +1,5 @@ + /* VMNetworkInterface.c - Native methods for NetworkInterface class +- Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc. ++ Copyright (C) 2003, 2005, 2006, 2008 Free Software Foundation, Inc. + + This file is part of GNU Classpath. + +@@ -50,11 +50,18 @@ + #include <stdio.h> + #include <string.h> + ++#include <net/if.h> ++#include <sys/ioctl.h> ++ + #include <jni.h> + #include <jcl.h> + ++#include <cpnative.h> ++#include <cpnet.h> ++ + #include "java_net_VMNetworkInterface.h" + ++int iff_flags(JNIEnv *, jstring, jint *); + + static jmethodID java_net_VMNetworkInterface_init; + static jmethodID java_net_VMNetworkInterface_addAddress; +@@ -251,4 +258,136 @@ + #endif /* HAVE_IFADDRS_H && HAVE_GETIFADDRS */ + } + ++int iff_flags(JNIEnv *env, jstring name, jint *flags) ++{ ++ struct ifreq iff; ++ const char *iff_name; ++ jint socket; ++ int error, retval; ++ ++ if ((error = cpnet_openSocketDatagram(env, &socket, AF_INET))) ++ { ++ return error; ++ } ++ ++ iff_name = JCL_jstring_to_cstring(env, name); ++ memset(&iff, 0, sizeof(iff)); ++ strcpy(iff.ifr_name, iff_name); ++ ++ if (ioctl(socket, SIOCGIFFLAGS, &iff) >= 0) ++ { ++ *flags = (jint) iff.ifr_flags; ++ ++ retval = 0; ++ } ++ else ++ { ++ retval = errno; ++ } ++ ++ cpnet_close(env, socket); ++ ++ JCL_free_cstring(env, name, iff_name); ++ ++ return retval; ++} ++ ++JNIEXPORT jboolean JNICALL ++Java_java_net_VMNetworkInterface_isUp (JNIEnv *env, jclass class UNUSED, ++ jstring name) ++{ ++ jint flags; ++ int error; ++ jboolean retval; ++ ++ if ((error = iff_flags(env, name, &flags))) ++ { ++ JCL_ThrowException(env, "java/net/SocketException", ++ cpnative_getErrorString(error)); ++ ++ retval = JNI_FALSE; ++ } ++ else ++ { ++ retval = (flags & (IFF_UP | IFF_RUNNING)) ++ ? JNI_TRUE ++ : JNI_FALSE; ++ } ++ ++ return retval; ++} ++ ++JNIEXPORT jboolean JNICALL ++Java_java_net_VMNetworkInterface_isPointToPoint (JNIEnv *env, ++ jclass class UNUSED, ++ jstring name) ++{ ++ jint flags; ++ int error; ++ jboolean retval; ++ ++ if ((error = iff_flags(env, name, &flags))) ++ { ++ JCL_ThrowException(env, "java/net/SocketException", ++ cpnative_getErrorString(error)); ++ ++ retval = JNI_FALSE; ++ } ++ else ++ { ++ retval = (flags & IFF_POINTOPOINT) ? JNI_TRUE ++ : JNI_FALSE; ++ } ++ ++ return retval; ++} ++ ++JNIEXPORT jboolean JNICALL ++Java_java_net_VMNetworkInterface_isLoopback (JNIEnv *env, ++ jclass class UNUSED, ++ jstring name) ++{ ++ jint flags; ++ int error; ++ jboolean retval; ++ ++ if ((error = iff_flags(env, name, &flags))) ++ { ++ JCL_ThrowException(env, "java/net/SocketException", ++ cpnative_getErrorString(error)); ++ ++ retval = JNI_FALSE; ++ } ++ else ++ { ++ retval = (flags & IFF_LOOPBACK) ? JNI_TRUE : JNI_FALSE; ++ } ++ ++ return retval; ++} ++ ++JNIEXPORT jboolean JNICALL ++Java_java_net_VMNetworkInterface_supportsMulticast (JNIEnv *env, ++ jclass class UNUSED, ++ jstring name) ++{ ++ jint flags; ++ int error; ++ jboolean retval; ++ ++ if ((error = iff_flags(env, name, &flags))) ++ { ++ JCL_ThrowException(env, "java/net/SocketException", ++ cpnative_getErrorString(error)); ++ ++ retval = JNI_FALSE; ++ } ++ else ++ { ++ retval = (flags & IFF_MULTICAST) ? JNI_TRUE : JNI_FALSE; ++ } ++ ++ return retval; ++} ++ + /* end of file */ |