8234629: remove unused functions from libnet
authormbaesken
Fri, 22 Nov 2019 10:29:12 +0100
changeset 59243 fb1d9bf1be2b
parent 59242 6ba3d8d41135
child 59244 6a897a8ef4af
8234629: remove unused functions from libnet Reviewed-by: alanb, vtewari
src/java.base/share/native/libnet/net_util.c
src/java.base/share/native/libnet/net_util.h
src/java.base/unix/native/libnet/DefaultProxySelector.c
src/java.base/unix/native/libnet/net_util_md.c
src/java.base/unix/native/libnet/net_util_md.h
--- a/src/java.base/share/native/libnet/net_util.c	Mon Nov 25 09:10:41 2019 +0000
+++ b/src/java.base/share/native/libnet/net_util.c	Fri Nov 22 10:29:12 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -115,12 +115,6 @@
  * get_ methods that return +ve int return -1 on error
  * get_ methods that return objects return NULL on error.
  */
-jobject getInet6Address_scopeifname(JNIEnv *env, jobject iaObj) {
-    jobject holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID);
-    CHECK_NULL_RETURN(holder, NULL);
-    return (*env)->GetObjectField(env, holder, ia6_scopeifnameID);
-}
-
 jboolean setInet6Address_scopeifname(JNIEnv *env, jobject iaObj, jobject scopeifname) {
     jobject holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID);
     CHECK_NULL_RETURN(holder, JNI_FALSE);
@@ -128,12 +122,6 @@
     return JNI_TRUE;
 }
 
-jboolean getInet6Address_scopeid_set(JNIEnv *env, jobject iaObj) {
-    jobject holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID);
-    CHECK_NULL_RETURN(holder, JNI_FALSE);
-    return (*env)->GetBooleanField(env, holder, ia6_scopeidsetID);
-}
-
 unsigned int getInet6Address_scopeid(JNIEnv *env, jobject iaObj) {
     jobject holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID);
     CHECK_NULL_RETURN(holder, 0);
@@ -208,12 +196,6 @@
     return (*env)->GetIntField(env, holder, iac_familyID);
 }
 
-jobject getInetAddress_hostName(JNIEnv *env, jobject iaObj) {
-    jobject holder = (*env)->GetObjectField(env, iaObj, ia_holderID);
-    CHECK_NULL_THROW_NPE_RETURN(env, holder, "InetAddress holder is null", NULL);
-    return (*env)->GetObjectField(env, holder, iac_hostNameID);
-}
-
 JNIEXPORT jobject JNICALL
 NET_SockaddrToInetAddress(JNIEnv *env, SOCKETADDRESS *sa, int *port) {
     jobject iaObj;
--- a/src/java.base/share/native/libnet/net_util.h	Mon Nov 25 09:10:41 2019 +0000
+++ b/src/java.base/share/native/libnet/net_util.h	Fri Nov 22 10:29:12 2019 +0100
@@ -61,9 +61,7 @@
  * get_ methods that return int/boolean, return -1 on error
  * get_ methods that return objects return NULL on error.
  */
-extern jobject getInet6Address_scopeifname(JNIEnv *env, jobject ia6Obj);
 extern jboolean setInet6Address_scopeifname(JNIEnv *env, jobject ia6Obj, jobject scopeifname);
-extern jboolean getInet6Address_scopeid_set(JNIEnv *env, jobject ia6Obj);
 extern unsigned int getInet6Address_scopeid(JNIEnv *env, jobject ia6Obj);
 extern jboolean setInet6Address_scopeid(JNIEnv *env, jobject ia6Obj, int scopeid);
 extern jboolean getInet6Address_ipaddress(JNIEnv *env, jobject ia6Obj, char *dest);
@@ -74,7 +72,6 @@
 extern void setInetAddress_hostName(JNIEnv *env, jobject iaObj, jobject h);
 extern int getInetAddress_addr(JNIEnv *env, jobject iaObj);
 extern int getInetAddress_family(JNIEnv *env, jobject iaObj);
-extern jobject getInetAddress_hostName(JNIEnv *env, jobject iaObj);
 
 extern jclass ia4_class;
 extern jmethodID ia4_ctrID;
--- a/src/java.base/unix/native/libnet/DefaultProxySelector.c	Mon Nov 25 09:10:41 2019 +0000
+++ b/src/java.base/unix/native/libnet/DefaultProxySelector.c	Fri Nov 22 10:29:12 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -74,7 +74,6 @@
 gconf_client_get_string_func* my_get_string_func = NULL;
 gconf_client_get_int_func* my_get_int_func = NULL;
 gconf_client_get_bool_func* my_get_bool_func = NULL;
-gconf_init_func* my_gconf_init_func = NULL;
 g_type_init_func* my_g_type_init_func = NULL;
 
 
--- a/src/java.base/unix/native/libnet/net_util_md.c	Mon Nov 25 09:10:41 2019 +0000
+++ b/src/java.base/unix/native/libnet/net_util_md.c	Fri Nov 22 10:29:12 2019 +0100
@@ -73,50 +73,6 @@
 #define UDP_EXCLBIND            0x0101
 #endif
 
-void setDefaultScopeID(JNIEnv *env, struct sockaddr *him)
-{
-#ifdef MACOSX
-    static jclass ni_class = NULL;
-    static jfieldID ni_defaultIndexID;
-    if (ni_class == NULL) {
-        jclass c = (*env)->FindClass(env, "java/net/NetworkInterface");
-        CHECK_NULL(c);
-        c = (*env)->NewGlobalRef(env, c);
-        CHECK_NULL(c);
-        ni_defaultIndexID = (*env)->GetStaticFieldID(env, c, "defaultIndex", "I");
-        CHECK_NULL(ni_defaultIndexID);
-        ni_class = c;
-    }
-    int defaultIndex;
-    struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)him;
-    if (sin6->sin6_family == AF_INET6 && (sin6->sin6_scope_id == 0) &&
-        (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) ||
-         IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))) {
-        defaultIndex = (*env)->GetStaticIntField(env, ni_class,
-                                                 ni_defaultIndexID);
-        sin6->sin6_scope_id = defaultIndex;
-    }
-#endif
-}
-
-int getDefaultScopeID(JNIEnv *env) {
-    int defaultIndex = 0;
-    static jclass ni_class = NULL;
-    static jfieldID ni_defaultIndexID;
-    if (ni_class == NULL) {
-        jclass c = (*env)->FindClass(env, "java/net/NetworkInterface");
-        CHECK_NULL_RETURN(c, 0);
-        c = (*env)->NewGlobalRef(env, c);
-        CHECK_NULL_RETURN(c, 0);
-        ni_defaultIndexID = (*env)->GetStaticFieldID(env, c, "defaultIndex", "I");
-        CHECK_NULL_RETURN(ni_defaultIndexID, 0);
-        ni_class = c;
-    }
-    defaultIndex = (*env)->GetStaticIntField(env, ni_class,
-                                             ni_defaultIndexID);
-    return defaultIndex;
-}
-
 #define RESTARTABLE(_cmd, _result) do { \
     do { \
         _result = _cmd; \
@@ -217,26 +173,6 @@
 }
 #endif
 
-#ifdef __linux__
-static int vinit = 0;
-static int kernelV24 = 0;
-static int vinit24 = 0;
-
-int kernelIsV24 () {
-    if (!vinit24) {
-        struct utsname sysinfo;
-        if (uname(&sysinfo) == 0) {
-            sysinfo.release[3] = '\0';
-            if (strcmp(sysinfo.release, "2.4") == 0) {
-                kernelV24 = JNI_TRUE;
-            }
-        }
-        vinit24 = 1;
-    }
-    return kernelV24;
-}
-#endif
-
 void
 NET_ThrowByNameWithLastError(JNIEnv *env, const char *name,
                    const char *defaultDetail) {
--- a/src/java.base/unix/native/libnet/net_util_md.h	Mon Nov 25 09:10:41 2019 +0000
+++ b/src/java.base/unix/native/libnet/net_util_md.h	Fri Nov 22 10:29:12 2019 +0100
@@ -98,10 +98,6 @@
                                   const char *defaultDetail);
 void NET_SetTrafficClass(SOCKETADDRESS *sa, int trafficClass);
 
-#ifdef __linux__
-int kernelIsV24();
-#endif
-
 #ifdef __solaris__
 int net_getParam(char *driver, char *param);
 #endif