Merge
This commit is contained in:
commit
8fe063908e
jdk/src
java.base/unix/native/libnet
jdk.unsupported/share/classes/sun/misc
@ -158,7 +158,10 @@ lookupIfLocalhost(JNIEnv *env, const char *hostname, jboolean includeV6)
|
||||
}
|
||||
|
||||
name = (*env)->NewStringUTF(env, hostname);
|
||||
CHECK_NULL_RETURN(name, NULL);
|
||||
if (name == NULL) {
|
||||
freeifaddrs(ifa);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Iterate over the interfaces, and total up the number of IPv4 and IPv6
|
||||
* addresses we have. Also keep a count of loopback addresses. We need to
|
||||
|
@ -243,6 +243,7 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByName0
|
||||
if (name_utf == NULL) {
|
||||
if (!(*env)->ExceptionCheck(env))
|
||||
JNU_ThrowOutOfMemoryError(env, NULL);
|
||||
freeif(ifs);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -519,7 +520,7 @@ JNIEXPORT jbyteArray JNICALL Java_java_net_NetworkInterface_getMacAddr0
|
||||
}
|
||||
if ((sock = openSocketWithFallback(env, name_utf)) < 0) {
|
||||
(*env)->ReleaseStringUTFChars(env, name, name_utf);
|
||||
return JNI_FALSE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!IS_NULL(addrArray)) {
|
||||
@ -664,7 +665,7 @@ jobject createNetworkInterface(JNIEnv *env, netif *ifs) {
|
||||
}
|
||||
|
||||
// Create the array of InetAddresses
|
||||
addrArr = (*env)->NewObjectArray(env, addr_count, ia_class, NULL);
|
||||
addrArr = (*env)->NewObjectArray(env, addr_count, ia_class, NULL);
|
||||
if (addrArr == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@ -1829,7 +1830,7 @@ static int getFlags(int sock, const char *ifname, int *flags) {
|
||||
strncpy(if2.lifr_name, ifname, sizeof(if2.lifr_name) - 1);
|
||||
|
||||
if (ioctl(sock, SIOCGLIFFLAGS, (char *)&if2) < 0) {
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
*flags = if2.lifr_flags;
|
||||
@ -1859,8 +1860,7 @@ static int openSocketWithFallback(JNIEnv *env, const char *ifname) {
|
||||
"IPV6 Socket creation failed");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else{ // errno is not NOSUPPORT
|
||||
} else { // errno is not NOSUPPORT
|
||||
NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
|
||||
"IPV4 Socket creation failed");
|
||||
return -1;
|
||||
|
@ -95,8 +95,8 @@ void setDefaultScopeID(JNIEnv *env, struct sockaddr *him)
|
||||
CHECK_NULL(c);
|
||||
c = (*env)->NewGlobalRef(env, c);
|
||||
CHECK_NULL(c);
|
||||
ni_defaultIndexID = (*env)->GetStaticFieldID(
|
||||
env, c, "defaultIndex", "I");
|
||||
ni_defaultIndexID = (*env)->GetStaticFieldID(env, c, "defaultIndex", "I");
|
||||
CHECK_NULL(ni_defaultIndexID);
|
||||
ni_class = c;
|
||||
}
|
||||
int defaultIndex;
|
||||
@ -118,8 +118,8 @@ int getDefaultScopeID(JNIEnv *env) {
|
||||
CHECK_NULL_RETURN(c, 0);
|
||||
c = (*env)->NewGlobalRef(env, c);
|
||||
CHECK_NULL_RETURN(c, 0);
|
||||
ni_defaultIndexID = (*env)->GetStaticFieldID(env, c,
|
||||
"defaultIndex", "I");
|
||||
ni_defaultIndexID = (*env)->GetStaticFieldID(env, c, "defaultIndex", "I");
|
||||
CHECK_NULL_RETURN(ni_defaultIndexID, 0);
|
||||
ni_class = c;
|
||||
}
|
||||
defaultIndex = (*env)->GetStaticIntField(env, ni_class,
|
||||
|
@ -296,45 +296,6 @@ public final class Unsafe {
|
||||
theInternalUnsafe.putDouble(o, offset, x);
|
||||
}
|
||||
|
||||
|
||||
// These read VM internal data.
|
||||
|
||||
/**
|
||||
* Fetches an uncompressed reference value from a given native variable
|
||||
* ignoring the VM's compressed references mode.
|
||||
*
|
||||
* @param address a memory address locating the variable
|
||||
* @return the value fetched from the indicated native variable
|
||||
*/
|
||||
@ForceInline
|
||||
public Object getUncompressedObject(long address) {
|
||||
return theInternalUnsafe.getUncompressedObject(address);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the {@link java.lang.Class} Java mirror for the given native
|
||||
* metaspace {@code Klass} pointer.
|
||||
*
|
||||
* @param metaspaceKlass a native metaspace {@code Klass} pointer
|
||||
* @return the {@link java.lang.Class} Java mirror
|
||||
*/
|
||||
@ForceInline
|
||||
public Class<?> getJavaMirror(long metaspaceKlass) {
|
||||
return theInternalUnsafe.getJavaMirror(metaspaceKlass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches a native metaspace {@code Klass} pointer for the given Java
|
||||
* object.
|
||||
*
|
||||
* @param o Java heap object for which to fetch the class pointer
|
||||
* @return a native metaspace {@code Klass} pointer
|
||||
*/
|
||||
@ForceInline
|
||||
public long getKlassPointer(Object o) {
|
||||
return theInternalUnsafe.getKlassPointer(o);
|
||||
}
|
||||
|
||||
// These work on values in the C heap.
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user