8234629: remove unused functions from libnet
Reviewed-by: alanb, vtewari
This commit is contained in:
parent
f4fced0e24
commit
6eedae02a7
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -115,12 +115,6 @@ extern jfieldID iac_familyID;
|
|||||||
* get_ methods that return +ve int return -1 on error
|
* get_ methods that return +ve int return -1 on error
|
||||||
* get_ methods that return objects return NULL 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) {
|
jboolean setInet6Address_scopeifname(JNIEnv *env, jobject iaObj, jobject scopeifname) {
|
||||||
jobject holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID);
|
jobject holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID);
|
||||||
CHECK_NULL_RETURN(holder, JNI_FALSE);
|
CHECK_NULL_RETURN(holder, JNI_FALSE);
|
||||||
@ -128,12 +122,6 @@ jboolean setInet6Address_scopeifname(JNIEnv *env, jobject iaObj, jobject scopeif
|
|||||||
return JNI_TRUE;
|
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) {
|
unsigned int getInet6Address_scopeid(JNIEnv *env, jobject iaObj) {
|
||||||
jobject holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID);
|
jobject holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID);
|
||||||
CHECK_NULL_RETURN(holder, 0);
|
CHECK_NULL_RETURN(holder, 0);
|
||||||
@ -208,12 +196,6 @@ int getInetAddress_family(JNIEnv *env, jobject iaObj) {
|
|||||||
return (*env)->GetIntField(env, holder, iac_familyID);
|
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
|
JNIEXPORT jobject JNICALL
|
||||||
NET_SockaddrToInetAddress(JNIEnv *env, SOCKETADDRESS *sa, int *port) {
|
NET_SockaddrToInetAddress(JNIEnv *env, SOCKETADDRESS *sa, int *port) {
|
||||||
jobject iaObj;
|
jobject iaObj;
|
||||||
|
@ -61,9 +61,7 @@ JNIEXPORT void JNICALL initInetAddressIDs(JNIEnv *env);
|
|||||||
* get_ methods that return int/boolean, return -1 on error
|
* get_ methods that return int/boolean, return -1 on error
|
||||||
* get_ methods that return objects return NULL 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 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 unsigned int getInet6Address_scopeid(JNIEnv *env, jobject ia6Obj);
|
||||||
extern jboolean setInet6Address_scopeid(JNIEnv *env, jobject ia6Obj, int scopeid);
|
extern jboolean setInet6Address_scopeid(JNIEnv *env, jobject ia6Obj, int scopeid);
|
||||||
extern jboolean getInet6Address_ipaddress(JNIEnv *env, jobject ia6Obj, char *dest);
|
extern jboolean getInet6Address_ipaddress(JNIEnv *env, jobject ia6Obj, char *dest);
|
||||||
@ -74,7 +72,6 @@ extern void setInetAddress_family(JNIEnv *env, jobject iaObj, int family);
|
|||||||
extern void setInetAddress_hostName(JNIEnv *env, jobject iaObj, jobject h);
|
extern void setInetAddress_hostName(JNIEnv *env, jobject iaObj, jobject h);
|
||||||
extern int getInetAddress_addr(JNIEnv *env, jobject iaObj);
|
extern int getInetAddress_addr(JNIEnv *env, jobject iaObj);
|
||||||
extern int getInetAddress_family(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 jclass ia4_class;
|
||||||
extern jmethodID ia4_ctrID;
|
extern jmethodID ia4_ctrID;
|
||||||
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -74,7 +74,6 @@ gconf_client_get_default_func* my_get_default_func = NULL;
|
|||||||
gconf_client_get_string_func* my_get_string_func = NULL;
|
gconf_client_get_string_func* my_get_string_func = NULL;
|
||||||
gconf_client_get_int_func* my_get_int_func = NULL;
|
gconf_client_get_int_func* my_get_int_func = NULL;
|
||||||
gconf_client_get_bool_func* my_get_bool_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;
|
g_type_init_func* my_g_type_init_func = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,50 +73,6 @@
|
|||||||
#define UDP_EXCLBIND 0x0101
|
#define UDP_EXCLBIND 0x0101
|
||||||
#endif
|
#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 { \
|
#define RESTARTABLE(_cmd, _result) do { \
|
||||||
do { \
|
do { \
|
||||||
_result = _cmd; \
|
_result = _cmd; \
|
||||||
@ -217,26 +173,6 @@ static int findMaxBuf(int fd, int opt, int sotype) {
|
|||||||
}
|
}
|
||||||
#endif
|
#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
|
void
|
||||||
NET_ThrowByNameWithLastError(JNIEnv *env, const char *name,
|
NET_ThrowByNameWithLastError(JNIEnv *env, const char *name,
|
||||||
const char *defaultDetail) {
|
const char *defaultDetail) {
|
||||||
|
@ -98,10 +98,6 @@ void NET_ThrowByNameWithLastError(JNIEnv *env, const char *name,
|
|||||||
const char *defaultDetail);
|
const char *defaultDetail);
|
||||||
void NET_SetTrafficClass(SOCKETADDRESS *sa, int trafficClass);
|
void NET_SetTrafficClass(SOCKETADDRESS *sa, int trafficClass);
|
||||||
|
|
||||||
#ifdef __linux__
|
|
||||||
int kernelIsV24();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __solaris__
|
#ifdef __solaris__
|
||||||
int net_getParam(char *driver, char *param);
|
int net_getParam(char *driver, char *param);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user