Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
d4681b69
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d4681b69
编写于
1月 27, 2010
作者:
C
chegar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6905552: libnet/nio portability issues
Reviewed-by: alanb
上级
d9f971bf
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
76 addition
and
26 deletion
+76
-26
src/share/native/java/net/net_util.c
src/share/native/java/net/net_util.c
+3
-2
src/solaris/native/java/net/Inet4AddressImpl.c
src/solaris/native/java/net/Inet4AddressImpl.c
+0
-5
src/solaris/native/java/net/Inet6AddressImpl.c
src/solaris/native/java/net/Inet6AddressImpl.c
+0
-7
src/solaris/native/java/net/NetworkInterface.c
src/solaris/native/java/net/NetworkInterface.c
+11
-0
src/solaris/native/java/net/PlainDatagramSocketImpl.c
src/solaris/native/java/net/PlainDatagramSocketImpl.c
+33
-5
src/solaris/native/java/net/net_util_md.c
src/solaris/native/java/net/net_util_md.c
+1
-2
src/solaris/native/java/net/net_util_md.h
src/solaris/native/java/net/net_util_md.h
+1
-1
src/solaris/native/sun/net/spi/SdpProvider.c
src/solaris/native/sun/net/spi/SdpProvider.c
+4
-0
src/solaris/native/sun/nio/ch/Net.c
src/solaris/native/sun/nio/ch/Net.c
+17
-2
src/solaris/native/sun/nio/ch/SctpNet.c
src/solaris/native/sun/nio/ch/SctpNet.c
+6
-2
未找到文件。
src/share/native/java/net/net_util.c
浏览文件 @
d4681b69
...
...
@@ -162,10 +162,11 @@ NET_SockaddrToInetAddress(JNIEnv *env, struct sockaddr *him, int *port) {
JNIEXPORT
jint
JNICALL
NET_SockaddrEqualsInetAddress
(
JNIEnv
*
env
,
struct
sockaddr
*
him
,
jobject
iaObj
)
{
jint
family
=
(
*
env
)
->
GetIntField
(
env
,
iaObj
,
ia_familyID
)
==
IPv4
?
AF_INET
:
AF_INET6
;
jint
family
=
AF_INET
;
#ifdef AF_INET6
family
=
(
*
env
)
->
GetIntField
(
env
,
iaObj
,
ia_familyID
)
==
IPv4
?
AF_INET
:
AF_INET6
;
if
(
him
->
sa_family
==
AF_INET6
)
{
#ifdef WIN32
struct
SOCKADDR_IN6
*
him6
=
(
struct
SOCKADDR_IN6
*
)
him
;
...
...
src/solaris/native/java/net/Inet4AddressImpl.c
浏览文件 @
d4681b69
...
...
@@ -46,11 +46,6 @@
#define HENT_BUF_SIZE 1024
#define BIG_HENT_BUF_SIZE 10240
/* a jumbo-sized one */
#ifndef __GLIBC__
/* gethostname() is in libc.so but I can't find a header file for it */
extern
int
gethostname
(
char
*
buf
,
int
buf_len
);
#endif
/************************************************************************
* Inet4AddressImpl
*/
...
...
src/solaris/native/java/net/Inet6AddressImpl.c
浏览文件 @
d4681b69
...
...
@@ -49,10 +49,6 @@
#define NI_MAXHOST 1025
#endif
#ifndef __GLIBC__
/* gethostname() is in libc.so but I can't find a header file for it */
extern
int
gethostname
(
char
*
buf
,
int
buf_len
);
#endif
/************************************************************************
* Inet6AddressImpl
...
...
@@ -360,8 +356,6 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
}
}
#endif
/* AF_INET6 */
cleanupAndReturn:
{
struct
addrinfo
*
iterator
,
*
tmp
;
...
...
@@ -374,7 +368,6 @@ cleanupAndReturn:
JNU_ReleaseStringPlatformChars
(
env
,
host
,
hostname
);
}
#ifdef AF_INET6
if
(
NET_addrtransAvailable
())
(
*
freeaddrinfo_ptr
)(
res
);
#endif
/* AF_INET6 */
...
...
src/solaris/native/java/net/NetworkInterface.c
浏览文件 @
d4681b69
...
...
@@ -253,8 +253,12 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0
(
JNIEnv
*
env
,
jclass
cls
,
jobject
iaObj
)
{
netif
*
ifs
,
*
curr
;
#ifdef AF_INET6
int
family
=
(
*
env
)
->
GetIntField
(
env
,
iaObj
,
ni_iafamilyID
)
==
IPv4
?
AF_INET
:
AF_INET6
;
#else
int
family
=
AF_INET
;
#endif
jobject
obj
=
NULL
;
jboolean
match
=
JNI_FALSE
;
...
...
@@ -1528,6 +1532,7 @@ JNIEXPORT jint JNICALL Java_java_net_NetworkInterface_getMTU0(JNIEnv *env, jclas
strcpy
((
caddr_t
)
&
(
lifr
.
lifr_name
),
name_utf
);
if
(
ioctl
(
sock
,
SIOCGLIFMTU
,
(
caddr_t
)
&
lifr
)
>=
0
)
{
ret
=
lifr
.
lifr_mtu
;
#ifdef AF_INET6
}
else
{
/* Try wIth an IPv6 socket in case the interface has only IPv6 addresses assigned to it */
close
(
sock
);
...
...
@@ -1547,6 +1552,12 @@ JNIEXPORT jint JNICALL Java_java_net_NetworkInterface_getMTU0(JNIEnv *env, jclas
"IOCTL failed"
);
}
}
#else
}
else
{
NET_ThrowByNameWithLastError
(
env
,
JNU_JAVANETPKG
"SocketException"
,
"IOCTL failed"
);
}
#endif
#endif
close
(
sock
);
}
...
...
src/solaris/native/java/net/PlainDatagramSocketImpl.c
浏览文件 @
d4681b69
...
...
@@ -605,8 +605,12 @@ Java_java_net_PlainDatagramSocketImpl_peek(JNIEnv *env, jobject this,
}
iaObj
=
NET_SockaddrToInetAddress
(
env
,
(
struct
sockaddr
*
)
&
remote_addr
,
&
port
);
#ifdef AF_INET6
family
=
(
*
env
)
->
GetIntField
(
env
,
iaObj
,
ia_familyID
)
==
IPv4
?
AF_INET
:
AF_INET6
;
#else
family
=
AF_INET
;
#endif
if
(
family
==
AF_INET
)
{
/* this api can't handle IPV6 addresses */
int
address
=
(
*
env
)
->
GetIntField
(
env
,
iaObj
,
ia_addressID
);
(
*
env
)
->
SetIntField
(
env
,
addressObj
,
ia_addressID
,
address
);
...
...
@@ -812,9 +816,9 @@ Java_java_net_PlainDatagramSocketImpl_receive0(JNIEnv *env, jobject this,
jboolean
retry
;
#ifdef __linux__
jboolean
connected
=
JNI_FALSE
;
jobject
connectedAddress
;
jint
connectedPort
;
jlong
prevTime
;
jobject
connectedAddress
=
NULL
;
jint
connectedPort
=
0
;
jlong
prevTime
=
0
;
#endif
if
(
IS_NULL
(
fdObj
))
{
...
...
@@ -1186,6 +1190,7 @@ static void mcast_set_if_by_if_v4(JNIEnv *env, jobject this, int fd, jobject val
* Set outgoing multicast interface designated by a NetworkInterface.
* Throw exception if failed.
*/
#ifdef AF_INET6
static
void
mcast_set_if_by_if_v6
(
JNIEnv
*
env
,
jobject
this
,
int
fd
,
jobject
value
)
{
static
jfieldID
ni_indexID
;
int
index
;
...
...
@@ -1222,6 +1227,7 @@ static void mcast_set_if_by_if_v6(JNIEnv *env, jobject this, int fd, jobject val
}
#endif
}
#endif
/* AF_INET6 */
/*
* Set outgoing multicast interface designated by an InetAddress.
...
...
@@ -1251,6 +1257,7 @@ static void mcast_set_if_by_addr_v4(JNIEnv *env, jobject this, int fd, jobject v
* Set outgoing multicast interface designated by an InetAddress.
* Throw exception if failed.
*/
#ifdef AF_INET6
static
void
mcast_set_if_by_addr_v6
(
JNIEnv
*
env
,
jobject
this
,
int
fd
,
jobject
value
)
{
static
jclass
ni_class
;
if
(
ni_class
==
NULL
)
{
...
...
@@ -1272,6 +1279,7 @@ static void mcast_set_if_by_addr_v6(JNIEnv *env, jobject this, int fd, jobject v
mcast_set_if_by_if_v6
(
env
,
this
,
fd
,
value
);
}
#endif
/*
* Sets the multicast interface.
...
...
@@ -1307,6 +1315,7 @@ static void setMulticastInterface(JNIEnv *env, jobject this, int fd,
/*
* value is an InetAddress.
*/
#ifdef AF_INET6
#ifdef __solaris__
if
(
ipv6_available
())
{
mcast_set_if_by_addr_v6
(
env
,
this
,
fd
,
value
);
...
...
@@ -1320,12 +1329,16 @@ static void setMulticastInterface(JNIEnv *env, jobject this, int fd,
mcast_set_if_by_addr_v6
(
env
,
this
,
fd
,
value
);
}
#endif
#else
mcast_set_if_by_addr_v4
(
env
,
this
,
fd
,
value
);
#endif
/* AF_INET6 */
}
if
(
opt
==
java_net_SocketOptions_IP_MULTICAST_IF2
)
{
/*
* value is a NetworkInterface.
*/
#ifdef AF_INET6
#ifdef __solaris__
if
(
ipv6_available
())
{
mcast_set_if_by_if_v6
(
env
,
this
,
fd
,
value
);
...
...
@@ -1339,6 +1352,9 @@ static void setMulticastInterface(JNIEnv *env, jobject this, int fd,
mcast_set_if_by_if_v6
(
env
,
this
,
fd
,
value
);
}
#endif
#else
mcast_set_if_by_if_v4
(
env
,
this
,
fd
,
value
);
#endif
/* AF_INET6 */
}
}
...
...
@@ -1368,6 +1384,7 @@ static void mcast_set_loop_v4(JNIEnv *env, jobject this, int fd, jobject value)
/*
* Enable/disable local loopback of multicast datagrams.
*/
#ifdef AF_INET6
static
void
mcast_set_loop_v6
(
JNIEnv
*
env
,
jobject
this
,
int
fd
,
jobject
value
)
{
jclass
cls
;
jfieldID
fid
;
...
...
@@ -1397,12 +1414,14 @@ static void mcast_set_loop_v6(JNIEnv *env, jobject this, int fd, jobject value)
}
#endif
}
#endif
/* AF_INET6 */
/*
* Sets the multicast loopback mode.
*/
static
void
setMulticastLoopbackMode
(
JNIEnv
*
env
,
jobject
this
,
int
fd
,
jint
opt
,
jobject
value
)
{
#ifdef AF_INET6
#ifdef __solaris__
if
(
ipv6_available
())
{
mcast_set_loop_v6
(
env
,
this
,
fd
,
value
);
...
...
@@ -1416,6 +1435,9 @@ static void setMulticastLoopbackMode(JNIEnv *env, jobject this, int fd,
mcast_set_loop_v6
(
env
,
this
,
fd
,
value
);
}
#endif
#else
mcast_set_loop_v4
(
env
,
this
,
fd
,
value
);
#endif
/* AF_INET6 */
}
/*
...
...
@@ -1838,7 +1860,7 @@ Java_java_net_PlainDatagramSocketImpl_socketGetOption(JNIEnv *env, jobject this,
if
(
opt
==
java_net_SocketOptions_SO_BINDADDR
)
{
/* find out local IP address */
SOCKADDR
him
;
in
t
len
=
0
;
socklen_
t
len
=
0
;
int
port
;
jobject
iaObj
;
...
...
@@ -1941,6 +1963,7 @@ static void setTTL(JNIEnv *env, int fd, jint ttl) {
/*
* Set hops limit for a socket. Throw exception if failed.
*/
#ifdef AF_INET6
static
void
setHopLimit
(
JNIEnv
*
env
,
int
fd
,
jint
ttl
)
{
int
ittl
=
(
int
)
ttl
;
if
(
JVM_SetSockOpt
(
fd
,
IPPROTO_IPV6
,
IPV6_MULTICAST_HOPS
,
...
...
@@ -1949,6 +1972,7 @@ static void setHopLimit(JNIEnv *env, int fd, jint ttl) {
"Error setting socket option"
);
}
}
#endif
/*
* Class: java_net_PlainDatagramSocketImpl
...
...
@@ -1971,6 +1995,7 @@ Java_java_net_PlainDatagramSocketImpl_setTimeToLive(JNIEnv *env, jobject this,
fd
=
(
*
env
)
->
GetIntField
(
env
,
fdObj
,
IO_fd_fdID
);
}
/* setsockopt to be correct ttl */
#ifdef AF_INET6
#ifdef __solaris__
if
(
ipv6_available
())
{
setHopLimit
(
env
,
fd
,
ttl
);
...
...
@@ -1986,7 +2011,10 @@ Java_java_net_PlainDatagramSocketImpl_setTimeToLive(JNIEnv *env, jobject this,
(
*
env
)
->
SetIntField
(
env
,
this
,
pdsi_ttlID
,
ttl
);
}
}
#endif
#endif // __linux__
#else
setTTL
(
env
,
fd
,
ttl
);
#endif
/* AF_INET6 */
}
/*
...
...
src/solaris/native/java/net/net_util_md.c
浏览文件 @
d4681b69
...
...
@@ -319,8 +319,6 @@ jint IPv6_supported()
#endif
/* __solaris */
#endif
/* AF_INET6 */
/*
* OK we may have the stack available in the kernel,
* we should also check if the APIs are available.
...
...
@@ -354,6 +352,7 @@ jint IPv6_supported()
close
(
fd
);
return
JNI_TRUE
;
#endif
/* AF_INET6 */
}
void
...
...
src/solaris/native/java/net/net_util_md.h
浏览文件 @
d4681b69
...
...
@@ -133,7 +133,7 @@ extern jint NET_Wait(JNIEnv *env, jint fd, jint flags, jint timeout);
#else
#define SOCKADDR union { struct sockaddr_in him4 }
#define SOCKADDR union { struct sockaddr_in him4
;
}
#define SOCKADDR_LEN sizeof(SOCKADDR)
#endif
...
...
src/solaris/native/sun/net/spi/SdpProvider.c
浏览文件 @
d4681b69
...
...
@@ -44,7 +44,11 @@ JNIEXPORT void JNICALL
Java_sun_net_spi_SdpProvider_convert
(
JNIEnv
*
env
,
jclass
cls
,
jint
fd
)
{
#ifdef PROTO_SDP
#ifdef AF_INET6
int
domain
=
ipv6_available
()
?
AF_INET6
:
AF_INET
;
#else
int
domain
=
AF_INET
;
#endif
int
s
=
socket
(
domain
,
SOCK_STREAM
,
PROTO_SDP
);
if
(
s
<
0
)
{
JNU_ThrowIOExceptionWithLastError
(
env
,
"socket"
);
...
...
src/solaris/native/sun/nio/ch/Net.c
浏览文件 @
d4681b69
...
...
@@ -124,6 +124,7 @@ struct my_group_source_req {
* Copy IPv6 group, interface index, and IPv6 source address
* into group_source_req structure.
*/
#ifdef AF_INET6
static
void
initGroupSourceReq
(
JNIEnv
*
env
,
jbyteArray
group
,
jint
index
,
jbyteArray
source
,
struct
my_group_source_req
*
req
)
{
...
...
@@ -139,7 +140,7 @@ static void initGroupSourceReq(JNIEnv* env, jbyteArray group, jint index,
sin6
->
sin6_family
=
AF_INET6
;
COPY_INET6_ADDRESS
(
env
,
source
,
(
jbyte
*
)
&
(
sin6
->
sin6_addr
));
}
#endif
JNIEXPORT
void
JNICALL
Java_sun_nio_ch_Net_initIDs
(
JNIEnv
*
env
,
jclass
clazz
)
...
...
@@ -159,7 +160,11 @@ Java_sun_nio_ch_Net_socket0(JNIEnv *env, jclass cl, jboolean preferIPv6,
{
int
fd
;
int
type
=
(
stream
?
SOCK_STREAM
:
SOCK_DGRAM
);
#ifdef AF_INET6
int
domain
=
(
ipv6_available
()
&&
preferIPv6
)
?
AF_INET6
:
AF_INET
;
#else
int
domain
=
AF_INET
;
#endif
fd
=
socket
(
domain
,
type
,
0
);
if
(
fd
<
0
)
{
...
...
@@ -176,7 +181,7 @@ Java_sun_nio_ch_Net_socket0(JNIEnv *env, jclass cl, jboolean preferIPv6,
return
-
1
;
}
}
#if
def __linux__
#if
defined(__linux__) && defined(AF_INET6)
/* By default, Linux uses the route default */
if
(
domain
==
AF_INET6
&&
type
==
SOCK_DGRAM
)
{
int
arg
=
1
;
...
...
@@ -424,6 +429,7 @@ JNIEXPORT jint JNICALL
Java_sun_nio_ch_Net_joinOrDrop6
(
JNIEnv
*
env
,
jobject
this
,
jboolean
join
,
jobject
fdo
,
jbyteArray
group
,
jint
index
,
jbyteArray
source
)
{
#ifdef AF_INET6
struct
ipv6_mreq
mreq6
;
struct
my_group_source_req
req
;
int
opt
,
n
,
optlen
;
...
...
@@ -454,12 +460,17 @@ Java_sun_nio_ch_Net_joinOrDrop6(JNIEnv *env, jobject this, jboolean join, jobjec
handleSocketError
(
env
,
errno
);
}
return
0
;
#else
JNU_ThrowInternalError
(
env
,
"Should not get here"
);
return
IOS_THROWN
;
#endif
/* AF_INET6 */
}
JNIEXPORT
jint
JNICALL
Java_sun_nio_ch_Net_blockOrUnblock6
(
JNIEnv
*
env
,
jobject
this
,
jboolean
block
,
jobject
fdo
,
jbyteArray
group
,
jint
index
,
jbyteArray
source
)
{
#ifdef AF_INET6
struct
my_group_source_req
req
;
int
n
;
int
opt
=
(
block
)
?
MCAST_BLOCK_SOURCE
:
MCAST_UNBLOCK_SOURCE
;
...
...
@@ -474,6 +485,10 @@ Java_sun_nio_ch_Net_blockOrUnblock6(JNIEnv *env, jobject this, jboolean block, j
handleSocketError
(
env
,
errno
);
}
return
0
;
#else
JNU_ThrowInternalError
(
env
,
"Should not get here"
);
return
IOS_THROWN
;
#endif
}
JNIEXPORT
void
JNICALL
...
...
src/solaris/native/sun/nio/ch/SctpNet.c
浏览文件 @
d4681b69
...
...
@@ -168,14 +168,18 @@ JNIEXPORT jint JNICALL Java_sun_nio_ch_SctpNet_socket0
(
JNIEnv
*
env
,
jclass
klass
,
jboolean
oneToOne
)
{
int
fd
;
struct
sctp_event_subscribe
event
;
#ifdef AF_INET6
int
domain
=
ipv6_available
()
?
AF_INET6
:
AF_INET
;
#else
int
domain
=
AF_INET
;
#endif
/* Try to load the socket API extension functions */
if
(
!
funcsLoaded
&&
!
loadSocketExtensionFuncs
(
env
))
{
return
0
;
}
fd
=
socket
(
ipv6_available
()
?
AF_INET6
:
AF_INET
,
(
oneToOne
?
SOCK_STREAM
:
SOCK_SEQPACKET
),
IPPROTO_SCTP
);
fd
=
socket
(
domain
,
(
oneToOne
?
SOCK_STREAM
:
SOCK_SEQPACKET
),
IPPROTO_SCTP
);
if
(
fd
<
0
)
{
return
handleSocketError
(
env
,
errno
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录