Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
3d7a9092
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3d7a9092
编写于
1月 20, 2014
作者:
S
simonis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8031997: PPC64: Make the various POLL constants system dependant
Reviewed-by: alanb
上级
dec1dfd1
变更
33
显示空白变更内容
内联
并排
Showing
33 changed file
with
232 addition
and
136 deletion
+232
-136
make/mapfiles/libnio/mapfile-linux
make/mapfiles/libnio/mapfile-linux
+6
-0
make/mapfiles/libnio/mapfile-macosx
make/mapfiles/libnio/mapfile-macosx
+6
-0
make/mapfiles/libnio/mapfile-solaris
make/mapfiles/libnio/mapfile-solaris
+6
-0
src/aix/classes/sun/nio/ch/AixPollPort.java
src/aix/classes/sun/nio/ch/AixPollPort.java
+4
-4
src/macosx/classes/sun/nio/ch/KQueueArrayWrapper.java
src/macosx/classes/sun/nio/ch/KQueueArrayWrapper.java
+3
-7
src/share/classes/sun/nio/ch/AbstractPollArrayWrapper.java
src/share/classes/sun/nio/ch/AbstractPollArrayWrapper.java
+0
-8
src/share/classes/sun/nio/ch/DatagramChannelImpl.java
src/share/classes/sun/nio/ch/DatagramChannelImpl.java
+7
-8
src/share/classes/sun/nio/ch/DatagramSocketAdaptor.java
src/share/classes/sun/nio/ch/DatagramSocketAdaptor.java
+2
-2
src/share/classes/sun/nio/ch/Net.java
src/share/classes/sun/nio/ch/Net.java
+25
-0
src/share/classes/sun/nio/ch/ServerSocketAdaptor.java
src/share/classes/sun/nio/ch/ServerSocketAdaptor.java
+1
-1
src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
+4
-5
src/share/classes/sun/nio/ch/SocketAdaptor.java
src/share/classes/sun/nio/ch/SocketAdaptor.java
+2
-2
src/share/classes/sun/nio/ch/SocketChannelImpl.java
src/share/classes/sun/nio/ch/SocketChannelImpl.java
+8
-9
src/solaris/classes/sun/nio/ch/EPollPort.java
src/solaris/classes/sun/nio/ch/EPollPort.java
+1
-1
src/solaris/classes/sun/nio/ch/KQueuePort.java
src/solaris/classes/sun/nio/ch/KQueuePort.java
+4
-4
src/solaris/classes/sun/nio/ch/PollArrayWrapper.java
src/solaris/classes/sun/nio/ch/PollArrayWrapper.java
+1
-3
src/solaris/classes/sun/nio/ch/Port.java
src/solaris/classes/sun/nio/ch/Port.java
+0
-4
src/solaris/classes/sun/nio/ch/SinkChannelImpl.java
src/solaris/classes/sun/nio/ch/SinkChannelImpl.java
+4
-5
src/solaris/classes/sun/nio/ch/SourceChannelImpl.java
src/solaris/classes/sun/nio/ch/SourceChannelImpl.java
+4
-5
src/solaris/classes/sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java
...s/sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java
+2
-2
src/solaris/classes/sun/nio/ch/UnixAsynchronousSocketChannelImpl.java
...classes/sun/nio/ch/UnixAsynchronousSocketChannelImpl.java
+5
-5
src/solaris/classes/sun/nio/ch/sctp/SctpChannelImpl.java
src/solaris/classes/sun/nio/ch/sctp/SctpChannelImpl.java
+8
-9
src/solaris/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java
...solaris/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java
+6
-7
src/solaris/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java
...olaris/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java
+4
-5
src/solaris/native/sun/nio/ch/IOUtil.c
src/solaris/native/sun/nio/ch/IOUtil.c
+0
-1
src/solaris/native/sun/nio/ch/Net.c
src/solaris/native/sun/nio/ch/Net.c
+37
-0
src/windows/classes/sun/nio/ch/PollArrayWrapper.java
src/windows/classes/sun/nio/ch/PollArrayWrapper.java
+1
-10
src/windows/classes/sun/nio/ch/SinkChannelImpl.java
src/windows/classes/sun/nio/ch/SinkChannelImpl.java
+4
-5
src/windows/classes/sun/nio/ch/SourceChannelImpl.java
src/windows/classes/sun/nio/ch/SourceChannelImpl.java
+4
-5
src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java
src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java
+6
-6
src/windows/native/sun/nio/ch/Net.c
src/windows/native/sun/nio/ch/Net.c
+42
-6
src/windows/native/sun/nio/ch/WindowsSelectorImpl.c
src/windows/native/sun/nio/ch/WindowsSelectorImpl.c
+7
-7
src/windows/native/sun/nio/ch/nio_util.h
src/windows/native/sun/nio/ch/nio_util.h
+18
-0
未找到文件。
make/mapfiles/libnio/mapfile-linux
浏览文件 @
3d7a9092
...
...
@@ -117,6 +117,12 @@ SUNWprivate_1.1 {
Java_sun_nio_ch_Net_getInterface6;
Java_sun_nio_ch_Net_shutdown;
Java_sun_nio_ch_Net_poll;
Java_sun_nio_ch_Net_pollinValue;
Java_sun_nio_ch_Net_polloutValue;
Java_sun_nio_ch_Net_pollerrValue;
Java_sun_nio_ch_Net_pollhupValue;
Java_sun_nio_ch_Net_pollnvalValue;
Java_sun_nio_ch_Net_pollconnValue;
Java_sun_nio_ch_Net_isExclusiveBindAvailable;
Java_sun_nio_ch_PollArrayWrapper_interrupt;
Java_sun_nio_ch_PollArrayWrapper_poll0;
...
...
make/mapfiles/libnio/mapfile-macosx
浏览文件 @
3d7a9092
...
...
@@ -109,6 +109,12 @@ SUNWprivate_1.1 {
Java_sun_nio_ch_Net_getInterface6;
Java_sun_nio_ch_Net_shutdown;
Java_sun_nio_ch_Net_poll;
Java_sun_nio_ch_Net_pollinValue;
Java_sun_nio_ch_Net_polloutValue;
Java_sun_nio_ch_Net_pollerrValue;
Java_sun_nio_ch_Net_pollhupValue;
Java_sun_nio_ch_Net_pollnvalValue;
Java_sun_nio_ch_Net_pollconnValue;
Java_sun_nio_ch_Net_isExclusiveBindAvailable;
Java_sun_nio_ch_PollArrayWrapper_interrupt;
Java_sun_nio_ch_PollArrayWrapper_poll0;
...
...
make/mapfiles/libnio/mapfile-solaris
浏览文件 @
3d7a9092
...
...
@@ -105,6 +105,12 @@ SUNWprivate_1.1 {
Java_sun_nio_ch_Net_getInterface6;
Java_sun_nio_ch_Net_shutdown;
Java_sun_nio_ch_Net_poll;
Java_sun_nio_ch_Net_pollinValue;
Java_sun_nio_ch_Net_polloutValue;
Java_sun_nio_ch_Net_pollerrValue;
Java_sun_nio_ch_Net_pollhupValue;
Java_sun_nio_ch_Net_pollnvalValue;
Java_sun_nio_ch_Net_pollconnValue;
Java_sun_nio_ch_Net_isExclusiveBindAvailable;
Java_sun_nio_ch_PollArrayWrapper_interrupt;
Java_sun_nio_ch_PollArrayWrapper_poll0;
...
...
src/aix/classes/sun/nio/ch/AixPollPort.java
浏览文件 @
3d7a9092
...
...
@@ -148,7 +148,7 @@ final class AixPollPort
try
{
socketpair
(
sv
);
// register one end with pollset
pollsetCtl
(
pollset
,
PS_ADD
,
sv
[
0
],
POLLIN
);
pollsetCtl
(
pollset
,
PS_ADD
,
sv
[
0
],
Net
.
POLLIN
);
}
catch
(
IOException
x
)
{
pollsetDestroy
(
pollset
);
throw
x
;
...
...
@@ -160,7 +160,7 @@ final class AixPollPort
try
{
socketpair
(
sv
);
// register one end with pollset
pollsetCtl
(
pollset
,
PS_ADD
,
sv
[
0
],
POLLIN
);
pollsetCtl
(
pollset
,
PS_ADD
,
sv
[
0
],
Net
.
POLLIN
);
}
catch
(
IOException
x
)
{
pollsetDestroy
(
pollset
);
throw
x
;
...
...
@@ -353,7 +353,7 @@ final class AixPollPort
// This is the only file descriptor without
// one shot semantic => register it again.
pollsetCtl
(
pollset
,
PS_ADD
,
sp
[
0
],
POLLIN
);
pollsetCtl
(
pollset
,
PS_ADD
,
sp
[
0
],
Net
.
POLLIN
);
// queue special event if there are more events
// to handle.
...
...
@@ -370,7 +370,7 @@ final class AixPollPort
drain1
(
ctlSp
[
0
]);
// This file descriptor does not have
// one shot semantic => register it again.
pollsetCtl
(
pollset
,
PS_ADD
,
ctlSp
[
0
],
POLLIN
);
pollsetCtl
(
pollset
,
PS_ADD
,
ctlSp
[
0
],
Net
.
POLLIN
);
processControlQueue
();
}
continue
;
...
...
src/macosx/classes/sun/nio/ch/KQueueArrayWrapper.java
浏览文件 @
3d7a9092
...
...
@@ -53,10 +53,6 @@ import java.util.LinkedList;
*/
class
KQueueArrayWrapper
{
// Event masks
static
final
short
POLLIN
=
AbstractPollArrayWrapper
.
POLLIN
;
static
final
short
POLLOUT
=
AbstractPollArrayWrapper
.
POLLOUT
;
// kevent filters
static
short
EVFILT_READ
;
static
short
EVFILT_WRITE
;
...
...
@@ -129,9 +125,9 @@ class KQueueArrayWrapper {
// SinkChannelImpl, SourceChannelImpl, DatagramChannelImpl,
// ServerSocketChannelImpl, SocketChannelImpl
if
(
filter
==
EVFILT_READ
)
{
result
|=
POLLIN
;
result
|=
Net
.
POLLIN
;
}
else
if
(
filter
==
EVFILT_WRITE
)
{
result
|=
POLLOUT
;
result
|=
Net
.
POLLOUT
;
}
return
result
;
...
...
@@ -180,7 +176,7 @@ class KQueueArrayWrapper {
if
(!
ch
.
isOpen
())
continue
;
register0
(
kq
,
ch
.
getFDVal
(),
u
.
events
&
POLLIN
,
u
.
events
&
POLLOUT
);
register0
(
kq
,
ch
.
getFDVal
(),
u
.
events
&
Net
.
POLLIN
,
u
.
events
&
Net
.
POLLOUT
);
}
}
}
...
...
src/share/classes/sun/nio/ch/AbstractPollArrayWrapper.java
浏览文件 @
3d7a9092
...
...
@@ -37,14 +37,6 @@ import sun.misc.*;
public
abstract
class
AbstractPollArrayWrapper
{
// Event masks
public
static
final
short
POLLIN
=
0x0001
;
public
static
final
short
POLLOUT
=
0x0004
;
public
static
final
short
POLLERR
=
0x0008
;
public
static
final
short
POLLHUP
=
0x0010
;
public
static
final
short
POLLNVAL
=
0x0020
;
public
static
final
short
POLLREMOVE
=
0x0800
;
// Miscellaneous constants
static
final
short
SIZE_POLLFD
=
8
;
static
final
short
FD_OFFSET
=
0
;
...
...
src/share/classes/sun/nio/ch/DatagramChannelImpl.java
浏览文件 @
3d7a9092
...
...
@@ -1042,25 +1042,24 @@ class DatagramChannelImpl
int
oldOps
=
sk
.
nioReadyOps
();
int
newOps
=
initialOps
;
if
((
ops
&
PollArrayWrapper
.
POLLNVAL
)
!=
0
)
{
if
((
ops
&
Net
.
POLLNVAL
)
!=
0
)
{
// This should only happen if this channel is pre-closed while a
// selection operation is in progress
// ## Throw an error if this channel has not been pre-closed
return
false
;
}
if
((
ops
&
(
PollArrayWrapper
.
POLLERR
|
PollArrayWrapper
.
POLLHUP
))
!=
0
)
{
if
((
ops
&
(
Net
.
POLLERR
|
Net
.
POLLHUP
))
!=
0
)
{
newOps
=
intOps
;
sk
.
nioReadyOps
(
newOps
);
return
(
newOps
&
~
oldOps
)
!=
0
;
}
if
(((
ops
&
PollArrayWrapper
.
POLLIN
)
!=
0
)
&&
if
(((
ops
&
Net
.
POLLIN
)
!=
0
)
&&
((
intOps
&
SelectionKey
.
OP_READ
)
!=
0
))
newOps
|=
SelectionKey
.
OP_READ
;
if
(((
ops
&
PollArrayWrapper
.
POLLOUT
)
!=
0
)
&&
if
(((
ops
&
Net
.
POLLOUT
)
!=
0
)
&&
((
intOps
&
SelectionKey
.
OP_WRITE
)
!=
0
))
newOps
|=
SelectionKey
.
OP_WRITE
;
...
...
@@ -1105,11 +1104,11 @@ class DatagramChannelImpl
int
newOps
=
0
;
if
((
ops
&
SelectionKey
.
OP_READ
)
!=
0
)
newOps
|=
PollArrayWrapper
.
POLLIN
;
newOps
|=
Net
.
POLLIN
;
if
((
ops
&
SelectionKey
.
OP_WRITE
)
!=
0
)
newOps
|=
PollArrayWrapper
.
POLLOUT
;
newOps
|=
Net
.
POLLOUT
;
if
((
ops
&
SelectionKey
.
OP_CONNECT
)
!=
0
)
newOps
|=
PollArrayWrapper
.
POLLIN
;
newOps
|=
Net
.
POLLIN
;
sk
.
selector
.
putEventOps
(
sk
,
newOps
);
}
...
...
src/share/classes/sun/nio/ch/DatagramSocketAdaptor.java
浏览文件 @
3d7a9092
...
...
@@ -187,9 +187,9 @@ public class DatagramSocketAdaptor
if
(!
dc
.
isOpen
())
throw
new
ClosedChannelException
();
long
st
=
System
.
currentTimeMillis
();
int
result
=
dc
.
poll
(
PollArrayWrapper
.
POLLIN
,
to
);
int
result
=
dc
.
poll
(
Net
.
POLLIN
,
to
);
if
(
result
>
0
&&
((
result
&
PollArrayWrapper
.
POLLIN
)
!=
0
))
{
((
result
&
Net
.
POLLIN
)
!=
0
))
{
if
((
sender
=
dc
.
receive
(
bb
))
!=
null
)
return
sender
;
}
...
...
src/share/classes/sun/nio/ch/Net.java
浏览文件 @
3d7a9092
...
...
@@ -581,9 +581,34 @@ public class Net {
private
static
native
void
initIDs
();
/**
* Event masks for the various poll system calls.
* They will be set platform dependant in the static initializer below.
*/
public
static
final
short
POLLIN
;
public
static
final
short
POLLOUT
;
public
static
final
short
POLLERR
;
public
static
final
short
POLLHUP
;
public
static
final
short
POLLNVAL
;
public
static
final
short
POLLCONN
;
static
native
short
pollinValue
();
static
native
short
polloutValue
();
static
native
short
pollerrValue
();
static
native
short
pollhupValue
();
static
native
short
pollnvalValue
();
static
native
short
pollconnValue
();
static
{
IOUtil
.
load
();
initIDs
();
POLLIN
=
pollinValue
();
POLLOUT
=
polloutValue
();
POLLERR
=
pollerrValue
();
POLLHUP
=
pollhupValue
();
POLLNVAL
=
pollnvalValue
();
POLLCONN
=
pollconnValue
();
}
}
src/share/classes/sun/nio/ch/ServerSocketAdaptor.java
浏览文件 @
3d7a9092
...
...
@@ -113,7 +113,7 @@ public class ServerSocketAdaptor // package-private
if
(!
ssc
.
isOpen
())
throw
new
ClosedChannelException
();
long
st
=
System
.
currentTimeMillis
();
int
result
=
ssc
.
poll
(
PollArrayWrapper
.
POLLIN
,
to
);
int
result
=
ssc
.
poll
(
Net
.
POLLIN
,
to
);
if
(
result
>
0
&&
((
sc
=
ssc
.
accept
())
!=
null
))
return
sc
.
socket
();
to
-=
System
.
currentTimeMillis
()
-
st
;
...
...
src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
浏览文件 @
3d7a9092
...
...
@@ -309,21 +309,20 @@ class ServerSocketChannelImpl
int
oldOps
=
sk
.
nioReadyOps
();
int
newOps
=
initialOps
;
if
((
ops
&
PollArrayWrapper
.
POLLNVAL
)
!=
0
)
{
if
((
ops
&
Net
.
POLLNVAL
)
!=
0
)
{
// This should only happen if this channel is pre-closed while a
// selection operation is in progress
// ## Throw an error if this channel has not been pre-closed
return
false
;
}
if
((
ops
&
(
PollArrayWrapper
.
POLLERR
|
PollArrayWrapper
.
POLLHUP
))
!=
0
)
{
if
((
ops
&
(
Net
.
POLLERR
|
Net
.
POLLHUP
))
!=
0
)
{
newOps
=
intOps
;
sk
.
nioReadyOps
(
newOps
);
return
(
newOps
&
~
oldOps
)
!=
0
;
}
if
(((
ops
&
PollArrayWrapper
.
POLLIN
)
!=
0
)
&&
if
(((
ops
&
Net
.
POLLIN
)
!=
0
)
&&
((
intOps
&
SelectionKey
.
OP_ACCEPT
)
!=
0
))
newOps
|=
SelectionKey
.
OP_ACCEPT
;
...
...
@@ -369,7 +368,7 @@ class ServerSocketChannelImpl
// Translate ops
if
((
ops
&
SelectionKey
.
OP_ACCEPT
)
!=
0
)
newOps
|=
PollArrayWrapper
.
POLLIN
;
newOps
|=
Net
.
POLLIN
;
// Place ops into pollfd array
sk
.
selector
.
putEventOps
(
sk
,
newOps
);
}
...
...
src/share/classes/sun/nio/ch/SocketAdaptor.java
浏览文件 @
3d7a9092
...
...
@@ -107,7 +107,7 @@ public class SocketAdaptor
throw
new
ClosedChannelException
();
long
st
=
System
.
currentTimeMillis
();
int
result
=
sc
.
poll
(
PollArrayWrapper
.
POLLCONN
,
to
);
int
result
=
sc
.
poll
(
Net
.
POLLCONN
,
to
);
if
(
result
>
0
&&
sc
.
finishConnect
())
break
;
to
-=
System
.
currentTimeMillis
()
-
st
;
...
...
@@ -201,7 +201,7 @@ public class SocketAdaptor
if
(!
sc
.
isOpen
())
throw
new
ClosedChannelException
();
long
st
=
System
.
currentTimeMillis
();
int
result
=
sc
.
poll
(
PollArrayWrapper
.
POLLIN
,
to
);
int
result
=
sc
.
poll
(
Net
.
POLLIN
,
to
);
if
(
result
>
0
)
{
if
((
n
=
sc
.
read
(
bb
))
!=
0
)
return
n
;
...
...
src/share/classes/sun/nio/ch/SocketChannelImpl.java
浏览文件 @
3d7a9092
...
...
@@ -884,15 +884,14 @@ class SocketChannelImpl
int
oldOps
=
sk
.
nioReadyOps
();
int
newOps
=
initialOps
;
if
((
ops
&
PollArrayWrapper
.
POLLNVAL
)
!=
0
)
{
if
((
ops
&
Net
.
POLLNVAL
)
!=
0
)
{
// This should only happen if this channel is pre-closed while a
// selection operation is in progress
// ## Throw an error if this channel has not been pre-closed
return
false
;
}
if
((
ops
&
(
PollArrayWrapper
.
POLLERR
|
PollArrayWrapper
.
POLLHUP
))
!=
0
)
{
if
((
ops
&
(
Net
.
POLLERR
|
Net
.
POLLHUP
))
!=
0
)
{
newOps
=
intOps
;
sk
.
nioReadyOps
(
newOps
);
// No need to poll again in checkConnect,
...
...
@@ -901,19 +900,19 @@ class SocketChannelImpl
return
(
newOps
&
~
oldOps
)
!=
0
;
}
if
(((
ops
&
PollArrayWrapper
.
POLLIN
)
!=
0
)
&&
if
(((
ops
&
Net
.
POLLIN
)
!=
0
)
&&
((
intOps
&
SelectionKey
.
OP_READ
)
!=
0
)
&&
(
state
==
ST_CONNECTED
))
newOps
|=
SelectionKey
.
OP_READ
;
if
(((
ops
&
PollArrayWrapper
.
POLLCONN
)
!=
0
)
&&
if
(((
ops
&
Net
.
POLLCONN
)
!=
0
)
&&
((
intOps
&
SelectionKey
.
OP_CONNECT
)
!=
0
)
&&
((
state
==
ST_UNCONNECTED
)
||
(
state
==
ST_PENDING
)))
{
newOps
|=
SelectionKey
.
OP_CONNECT
;
readyToConnect
=
true
;
}
if
(((
ops
&
PollArrayWrapper
.
POLLOUT
)
!=
0
)
&&
if
(((
ops
&
Net
.
POLLOUT
)
!=
0
)
&&
((
intOps
&
SelectionKey
.
OP_WRITE
)
!=
0
)
&&
(
state
==
ST_CONNECTED
))
newOps
|=
SelectionKey
.
OP_WRITE
;
...
...
@@ -958,11 +957,11 @@ class SocketChannelImpl
public
void
translateAndSetInterestOps
(
int
ops
,
SelectionKeyImpl
sk
)
{
int
newOps
=
0
;
if
((
ops
&
SelectionKey
.
OP_READ
)
!=
0
)
newOps
|=
PollArrayWrapper
.
POLLIN
;
newOps
|=
Net
.
POLLIN
;
if
((
ops
&
SelectionKey
.
OP_WRITE
)
!=
0
)
newOps
|=
PollArrayWrapper
.
POLLOUT
;
newOps
|=
Net
.
POLLOUT
;
if
((
ops
&
SelectionKey
.
OP_CONNECT
)
!=
0
)
newOps
|=
PollArrayWrapper
.
POLLCONN
;
newOps
|=
Net
.
POLLCONN
;
sk
.
selector
.
putEventOps
(
sk
,
newOps
);
}
...
...
src/solaris/classes/sun/nio/ch/EPollPort.java
浏览文件 @
3d7a9092
...
...
@@ -93,7 +93,7 @@ final class EPollPort
try
{
socketpair
(
sv
);
// register one end with epoll
epollCtl
(
epfd
,
EPOLL_CTL_ADD
,
sv
[
0
],
POLLIN
);
epollCtl
(
epfd
,
EPOLL_CTL_ADD
,
sv
[
0
],
Net
.
POLLIN
);
}
catch
(
IOException
x
)
{
close0
(
epfd
);
throw
x
;
...
...
src/solaris/classes/sun/nio/ch/KQueuePort.java
浏览文件 @
3d7a9092
...
...
@@ -172,9 +172,9 @@ final class KQueuePort
// TBD: Measure cost of EV_ONESHOT vs. EV_CLEAR, either will do here.
int
err
=
0
;
int
flags
=
(
EV_ADD
|
EV_ONESHOT
);
if
((
events
&
Por
t
.
POLLIN
)
>
0
)
if
((
events
&
Ne
t
.
POLLIN
)
>
0
)
err
=
keventRegister
(
kqfd
,
fd
,
EVFILT_READ
,
flags
);
if
(
err
==
0
&&
(
events
&
Por
t
.
POLLOUT
)
>
0
)
if
(
err
==
0
&&
(
events
&
Ne
t
.
POLLOUT
)
>
0
)
err
=
keventRegister
(
kqfd
,
fd
,
EVFILT_WRITE
,
flags
);
if
(
err
!=
0
)
throw
new
InternalError
(
"kevent failed: "
+
err
);
// should not happen
...
...
@@ -227,9 +227,9 @@ final class KQueuePort
int
filter
=
getFilter
(
keventAddress
);
int
events
=
0
;
if
(
filter
==
EVFILT_READ
)
events
=
Por
t
.
POLLIN
;
events
=
Ne
t
.
POLLIN
;
else
if
(
filter
==
EVFILT_WRITE
)
events
=
Por
t
.
POLLOUT
;
events
=
Ne
t
.
POLLOUT
;
Event
ev
=
new
Event
(
channel
,
events
);
...
...
src/solaris/classes/sun/nio/ch/PollArrayWrapper.java
浏览文件 @
3d7a9092
...
...
@@ -43,8 +43,6 @@ import sun.misc.*;
public
class
PollArrayWrapper
extends
AbstractPollArrayWrapper
{
public
static
final
short
POLLCONN
=
POLLOUT
;
// File descriptor to write for interrupt
int
interruptFD
;
...
...
@@ -58,7 +56,7 @@ public class PollArrayWrapper extends AbstractPollArrayWrapper {
void
initInterrupt
(
int
fd0
,
int
fd1
)
{
interruptFD
=
fd1
;
putDescriptor
(
0
,
fd0
);
putEventOps
(
0
,
POLLIN
);
putEventOps
(
0
,
Net
.
POLLIN
);
putReventOps
(
0
,
0
);
}
...
...
src/solaris/classes/sun/nio/ch/Port.java
浏览文件 @
3d7a9092
...
...
@@ -40,10 +40,6 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
*/
abstract
class
Port
extends
AsynchronousChannelGroupImpl
{
static
final
short
POLLIN
=
0x0001
;
static
final
short
POLLOUT
=
0x0004
;
static
final
short
POLLERR
=
0x0008
;
static
final
short
POLLHUP
=
0x0010
;
/**
* Implemented by clients registered with this port.
...
...
src/solaris/classes/sun/nio/ch/SinkChannelImpl.java
浏览文件 @
3d7a9092
...
...
@@ -118,17 +118,16 @@ class SinkChannelImpl
int
oldOps
=
sk
.
nioReadyOps
();
int
newOps
=
initialOps
;
if
((
ops
&
PollArrayWrapper
.
POLLNVAL
)
!=
0
)
if
((
ops
&
Net
.
POLLNVAL
)
!=
0
)
throw
new
Error
(
"POLLNVAL detected"
);
if
((
ops
&
(
PollArrayWrapper
.
POLLERR
|
PollArrayWrapper
.
POLLHUP
))
!=
0
)
{
if
((
ops
&
(
Net
.
POLLERR
|
Net
.
POLLHUP
))
!=
0
)
{
newOps
=
intOps
;
sk
.
nioReadyOps
(
newOps
);
return
(
newOps
&
~
oldOps
)
!=
0
;
}
if
(((
ops
&
PollArrayWrapper
.
POLLOUT
)
!=
0
)
&&
if
(((
ops
&
Net
.
POLLOUT
)
!=
0
)
&&
((
intOps
&
SelectionKey
.
OP_WRITE
)
!=
0
))
newOps
|=
SelectionKey
.
OP_WRITE
;
...
...
@@ -146,7 +145,7 @@ class SinkChannelImpl
public
void
translateAndSetInterestOps
(
int
ops
,
SelectionKeyImpl
sk
)
{
if
(
ops
==
SelectionKey
.
OP_WRITE
)
ops
=
PollArrayWrapper
.
POLLOUT
;
ops
=
Net
.
POLLOUT
;
sk
.
selector
.
putEventOps
(
sk
,
ops
);
}
...
...
src/solaris/classes/sun/nio/ch/SourceChannelImpl.java
浏览文件 @
3d7a9092
...
...
@@ -118,17 +118,16 @@ class SourceChannelImpl
int
oldOps
=
sk
.
nioReadyOps
();
int
newOps
=
initialOps
;
if
((
ops
&
PollArrayWrapper
.
POLLNVAL
)
!=
0
)
if
((
ops
&
Net
.
POLLNVAL
)
!=
0
)
throw
new
Error
(
"POLLNVAL detected"
);
if
((
ops
&
(
PollArrayWrapper
.
POLLERR
|
PollArrayWrapper
.
POLLHUP
))
!=
0
)
{
if
((
ops
&
(
Net
.
POLLERR
|
Net
.
POLLHUP
))
!=
0
)
{
newOps
=
intOps
;
sk
.
nioReadyOps
(
newOps
);
return
(
newOps
&
~
oldOps
)
!=
0
;
}
if
(((
ops
&
PollArrayWrapper
.
POLLIN
)
!=
0
)
&&
if
(((
ops
&
Net
.
POLLIN
)
!=
0
)
&&
((
intOps
&
SelectionKey
.
OP_READ
)
!=
0
))
newOps
|=
SelectionKey
.
OP_READ
;
...
...
@@ -146,7 +145,7 @@ class SourceChannelImpl
public
void
translateAndSetInterestOps
(
int
ops
,
SelectionKeyImpl
sk
)
{
if
(
ops
==
SelectionKey
.
OP_READ
)
ops
=
PollArrayWrapper
.
POLLIN
;
ops
=
Net
.
POLLIN
;
sk
.
selector
.
putEventOps
(
sk
,
ops
);
}
...
...
src/solaris/classes/sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java
浏览文件 @
3d7a9092
...
...
@@ -148,7 +148,7 @@ class UnixAsynchronousServerSocketChannelImpl
synchronized
(
updateLock
)
{
acceptPending
=
true
;
}
port
.
startPoll
(
fdVal
,
Por
t
.
POLLIN
);
port
.
startPoll
(
fdVal
,
Ne
t
.
POLLIN
);
return
;
}
...
...
@@ -299,7 +299,7 @@ class UnixAsynchronousServerSocketChannelImpl
}
// register for connections
port
.
startPoll
(
fdVal
,
Por
t
.
POLLIN
);
port
.
startPoll
(
fdVal
,
Ne
t
.
POLLIN
);
return
result
;
}
}
catch
(
Throwable
x
)
{
...
...
src/solaris/classes/sun/nio/ch/UnixAsynchronousSocketChannelImpl.java
浏览文件 @
3d7a9092
...
...
@@ -142,9 +142,9 @@ class UnixAsynchronousSocketChannelImpl
assert
Thread
.
holdsLock
(
updateLock
);
int
events
=
0
;
if
(
readPending
)
events
|=
Por
t
.
POLLIN
;
events
|=
Ne
t
.
POLLIN
;
if
(
connectPending
||
writePending
)
events
|=
Por
t
.
POLLOUT
;
events
|=
Ne
t
.
POLLOUT
;
if
(
events
!=
0
)
port
.
startPoll
(
fdVal
,
events
);
}
...
...
@@ -204,9 +204,9 @@ class UnixAsynchronousSocketChannelImpl
*/
@Override
public
void
onEvent
(
int
events
,
boolean
mayInvokeDirect
)
{
boolean
readable
=
(
events
&
Por
t
.
POLLIN
)
>
0
;
boolean
writable
=
(
events
&
Por
t
.
POLLOUT
)
>
0
;
if
((
events
&
(
Port
.
POLLERR
|
Por
t
.
POLLHUP
))
>
0
)
{
boolean
readable
=
(
events
&
Ne
t
.
POLLIN
)
>
0
;
boolean
writable
=
(
events
&
Ne
t
.
POLLOUT
)
>
0
;
if
((
events
&
(
Net
.
POLLERR
|
Ne
t
.
POLLHUP
))
>
0
)
{
readable
=
true
;
writable
=
true
;
}
...
...
src/solaris/classes/sun/nio/ch/sctp/SctpChannelImpl.java
浏览文件 @
3d7a9092
...
...
@@ -589,15 +589,14 @@ public class SctpChannelImpl extends SctpChannel
int
oldOps
=
sk
.
nioReadyOps
();
int
newOps
=
initialOps
;
if
((
ops
&
PollArrayWrapper
.
POLLNVAL
)
!=
0
)
{
if
((
ops
&
Net
.
POLLNVAL
)
!=
0
)
{
/* This should only happen if this channel is pre-closed while a
* selection operation is in progress
* ## Throw an error if this channel has not been pre-closed */
return
false
;
}
if
((
ops
&
(
PollArrayWrapper
.
POLLERR
|
PollArrayWrapper
.
POLLHUP
))
!=
0
)
{
if
((
ops
&
(
Net
.
POLLERR
|
Net
.
POLLHUP
))
!=
0
)
{
newOps
=
intOps
;
sk
.
nioReadyOps
(
newOps
);
/* No need to poll again in checkConnect,
...
...
@@ -606,19 +605,19 @@ public class SctpChannelImpl extends SctpChannel
return
(
newOps
&
~
oldOps
)
!=
0
;
}
if
(((
ops
&
PollArrayWrapper
.
POLLIN
)
!=
0
)
&&
if
(((
ops
&
Net
.
POLLIN
)
!=
0
)
&&
((
intOps
&
SelectionKey
.
OP_READ
)
!=
0
)
&&
isConnected
())
newOps
|=
SelectionKey
.
OP_READ
;
if
(((
ops
&
PollArrayWrapper
.
POLLCONN
)
!=
0
)
&&
if
(((
ops
&
Net
.
POLLCONN
)
!=
0
)
&&
((
intOps
&
SelectionKey
.
OP_CONNECT
)
!=
0
)
&&
((
state
==
ChannelState
.
UNCONNECTED
)
||
(
state
==
ChannelState
.
PENDING
)))
{
newOps
|=
SelectionKey
.
OP_CONNECT
;
readyToConnect
=
true
;
}
if
(((
ops
&
PollArrayWrapper
.
POLLOUT
)
!=
0
)
&&
if
(((
ops
&
Net
.
POLLOUT
)
!=
0
)
&&
((
intOps
&
SelectionKey
.
OP_WRITE
)
!=
0
)
&&
isConnected
())
newOps
|=
SelectionKey
.
OP_WRITE
;
...
...
@@ -642,11 +641,11 @@ public class SctpChannelImpl extends SctpChannel
public
void
translateAndSetInterestOps
(
int
ops
,
SelectionKeyImpl
sk
)
{
int
newOps
=
0
;
if
((
ops
&
SelectionKey
.
OP_READ
)
!=
0
)
newOps
|=
PollArrayWrapper
.
POLLIN
;
newOps
|=
Net
.
POLLIN
;
if
((
ops
&
SelectionKey
.
OP_WRITE
)
!=
0
)
newOps
|=
PollArrayWrapper
.
POLLOUT
;
newOps
|=
Net
.
POLLOUT
;
if
((
ops
&
SelectionKey
.
OP_CONNECT
)
!=
0
)
newOps
|=
PollArrayWrapper
.
POLLCONN
;
newOps
|=
Net
.
POLLCONN
;
sk
.
selector
.
putEventOps
(
sk
,
newOps
);
}
...
...
src/solaris/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java
浏览文件 @
3d7a9092
...
...
@@ -321,25 +321,24 @@ public class SctpMultiChannelImpl extends SctpMultiChannel
int
oldOps
=
sk
.
nioReadyOps
();
int
newOps
=
initialOps
;
if
((
ops
&
PollArrayWrapper
.
POLLNVAL
)
!=
0
)
{
if
((
ops
&
Net
.
POLLNVAL
)
!=
0
)
{
/* This should only happen if this channel is pre-closed while a
* selection operation is in progress
* ## Throw an error if this channel has not been pre-closed */
return
false
;
}
if
((
ops
&
(
PollArrayWrapper
.
POLLERR
|
PollArrayWrapper
.
POLLHUP
))
!=
0
)
{
if
((
ops
&
(
Net
.
POLLERR
|
Net
.
POLLHUP
))
!=
0
)
{
newOps
=
intOps
;
sk
.
nioReadyOps
(
newOps
);
return
(
newOps
&
~
oldOps
)
!=
0
;
}
if
(((
ops
&
PollArrayWrapper
.
POLLIN
)
!=
0
)
&&
if
(((
ops
&
Net
.
POLLIN
)
!=
0
)
&&
((
intOps
&
SelectionKey
.
OP_READ
)
!=
0
))
newOps
|=
SelectionKey
.
OP_READ
;
if
(((
ops
&
PollArrayWrapper
.
POLLOUT
)
!=
0
)
&&
if
(((
ops
&
Net
.
POLLOUT
)
!=
0
)
&&
((
intOps
&
SelectionKey
.
OP_WRITE
)
!=
0
))
newOps
|=
SelectionKey
.
OP_WRITE
;
...
...
@@ -361,9 +360,9 @@ public class SctpMultiChannelImpl extends SctpMultiChannel
public
void
translateAndSetInterestOps
(
int
ops
,
SelectionKeyImpl
sk
)
{
int
newOps
=
0
;
if
((
ops
&
SelectionKey
.
OP_READ
)
!=
0
)
newOps
|=
PollArrayWrapper
.
POLLIN
;
newOps
|=
Net
.
POLLIN
;
if
((
ops
&
SelectionKey
.
OP_WRITE
)
!=
0
)
newOps
|=
PollArrayWrapper
.
POLLOUT
;
newOps
|=
Net
.
POLLOUT
;
sk
.
selector
.
putEventOps
(
sk
,
newOps
);
}
...
...
src/solaris/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java
浏览文件 @
3d7a9092
...
...
@@ -314,21 +314,20 @@ public class SctpServerChannelImpl extends SctpServerChannel
int
oldOps
=
sk
.
nioReadyOps
();
int
newOps
=
initialOps
;
if
((
ops
&
PollArrayWrapper
.
POLLNVAL
)
!=
0
)
{
if
((
ops
&
Net
.
POLLNVAL
)
!=
0
)
{
/* This should only happen if this channel is pre-closed while a
* selection operation is in progress
* ## Throw an error if this channel has not been pre-closed */
return
false
;
}
if
((
ops
&
(
PollArrayWrapper
.
POLLERR
|
PollArrayWrapper
.
POLLHUP
))
!=
0
)
{
if
((
ops
&
(
Net
.
POLLERR
|
Net
.
POLLHUP
))
!=
0
)
{
newOps
=
intOps
;
sk
.
nioReadyOps
(
newOps
);
return
(
newOps
&
~
oldOps
)
!=
0
;
}
if
(((
ops
&
PollArrayWrapper
.
POLLIN
)
!=
0
)
&&
if
(((
ops
&
Net
.
POLLIN
)
!=
0
)
&&
((
intOps
&
SelectionKey
.
OP_ACCEPT
)
!=
0
))
newOps
|=
SelectionKey
.
OP_ACCEPT
;
...
...
@@ -352,7 +351,7 @@ public class SctpServerChannelImpl extends SctpServerChannel
/* Translate ops */
if
((
ops
&
SelectionKey
.
OP_ACCEPT
)
!=
0
)
newOps
|=
PollArrayWrapper
.
POLLIN
;
newOps
|=
Net
.
POLLIN
;
/* Place ops into pollfd array */
sk
.
selector
.
putEventOps
(
sk
,
newOps
);
...
...
src/solaris/native/sun/nio/ch/IOUtil.c
浏览文件 @
3d7a9092
...
...
@@ -145,7 +145,6 @@ Java_sun_nio_ch_IOUtil_iovMax(JNIEnv *env, jclass this)
return
(
jint
)
iov_max
;
}
/* Declared in nio_util.h for use elsewhere in NIO */
jint
...
...
src/solaris/native/sun/nio/ch/Net.c
浏览文件 @
3d7a9092
...
...
@@ -23,6 +23,7 @@
* questions.
*/
#include <sys/poll.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <string.h>
...
...
@@ -749,6 +750,42 @@ Java_sun_nio_ch_Net_poll(JNIEnv* env, jclass this, jobject fdo, jint events, jlo
}
}
JNIEXPORT
jshort
JNICALL
Java_sun_nio_ch_Net_pollinValue
(
JNIEnv
*
env
,
jclass
this
)
{
return
(
jshort
)
POLLIN
;
}
JNIEXPORT
jshort
JNICALL
Java_sun_nio_ch_Net_polloutValue
(
JNIEnv
*
env
,
jclass
this
)
{
return
(
jshort
)
POLLOUT
;
}
JNIEXPORT
jshort
JNICALL
Java_sun_nio_ch_Net_pollerrValue
(
JNIEnv
*
env
,
jclass
this
)
{
return
(
jshort
)
POLLERR
;
}
JNIEXPORT
jshort
JNICALL
Java_sun_nio_ch_Net_pollhupValue
(
JNIEnv
*
env
,
jclass
this
)
{
return
(
jshort
)
POLLHUP
;
}
JNIEXPORT
jshort
JNICALL
Java_sun_nio_ch_Net_pollnvalValue
(
JNIEnv
*
env
,
jclass
this
)
{
return
(
jshort
)
POLLNVAL
;
}
JNIEXPORT
jshort
JNICALL
Java_sun_nio_ch_Net_pollconnValue
(
JNIEnv
*
env
,
jclass
this
)
{
return
(
jshort
)
POLLOUT
;
}
/* Declared in nio_util.h */
...
...
src/windows/classes/sun/nio/ch/PollArrayWrapper.java
浏览文件 @
3d7a9092
...
...
@@ -53,15 +53,6 @@ class PollArrayWrapper {
static
short
SIZE_POLLFD
=
8
;
// sizeof pollfd struct
// events masks
@Native
static
final
short
POLLIN
=
AbstractPollArrayWrapper
.
POLLIN
;
@Native
static
final
short
POLLOUT
=
AbstractPollArrayWrapper
.
POLLOUT
;
@Native
static
final
short
POLLERR
=
AbstractPollArrayWrapper
.
POLLERR
;
@Native
static
final
short
POLLHUP
=
AbstractPollArrayWrapper
.
POLLHUP
;
@Native
static
final
short
POLLNVAL
=
AbstractPollArrayWrapper
.
POLLNVAL
;
@Native
static
final
short
POLLREMOVE
=
AbstractPollArrayWrapper
.
POLLREMOVE
;
@Native
static
final
short
POLLCONN
=
0x0002
;
private
int
size
;
// Size of the pollArray
PollArrayWrapper
(
int
newSize
)
{
...
...
@@ -119,6 +110,6 @@ class PollArrayWrapper {
// Adds Windows wakeup socket at a given index.
void
addWakeupSocket
(
int
fdVal
,
int
index
)
{
putDescriptor
(
index
,
fdVal
);
putEventOps
(
index
,
POLLIN
);
putEventOps
(
index
,
Net
.
POLLIN
);
}
}
src/windows/classes/sun/nio/ch/SinkChannelImpl.java
浏览文件 @
3d7a9092
...
...
@@ -78,17 +78,16 @@ class SinkChannelImpl
int
oldOps
=
sk
.
nioReadyOps
();
int
newOps
=
initialOps
;
if
((
ops
&
PollArrayWrapper
.
POLLNVAL
)
!=
0
)
if
((
ops
&
Net
.
POLLNVAL
)
!=
0
)
throw
new
Error
(
"POLLNVAL detected"
);
if
((
ops
&
(
PollArrayWrapper
.
POLLERR
|
PollArrayWrapper
.
POLLHUP
))
!=
0
)
{
if
((
ops
&
(
Net
.
POLLERR
|
Net
.
POLLHUP
))
!=
0
)
{
newOps
=
intOps
;
sk
.
nioReadyOps
(
newOps
);
return
(
newOps
&
~
oldOps
)
!=
0
;
}
if
(((
ops
&
PollArrayWrapper
.
POLLOUT
)
!=
0
)
&&
if
(((
ops
&
Net
.
POLLOUT
)
!=
0
)
&&
((
intOps
&
SelectionKey
.
OP_WRITE
)
!=
0
))
newOps
|=
SelectionKey
.
OP_WRITE
;
...
...
@@ -106,7 +105,7 @@ class SinkChannelImpl
public
void
translateAndSetInterestOps
(
int
ops
,
SelectionKeyImpl
sk
)
{
if
((
ops
&
SelectionKey
.
OP_WRITE
)
!=
0
)
ops
=
PollArrayWrapper
.
POLLOUT
;
ops
=
Net
.
POLLOUT
;
sk
.
selector
.
putEventOps
(
sk
,
ops
);
}
...
...
src/windows/classes/sun/nio/ch/SourceChannelImpl.java
浏览文件 @
3d7a9092
...
...
@@ -77,17 +77,16 @@ class SourceChannelImpl
int
oldOps
=
sk
.
nioReadyOps
();
int
newOps
=
initialOps
;
if
((
ops
&
PollArrayWrapper
.
POLLNVAL
)
!=
0
)
if
((
ops
&
Net
.
POLLNVAL
)
!=
0
)
throw
new
Error
(
"POLLNVAL detected"
);
if
((
ops
&
(
PollArrayWrapper
.
POLLERR
|
PollArrayWrapper
.
POLLHUP
))
!=
0
)
{
if
((
ops
&
(
Net
.
POLLERR
|
Net
.
POLLHUP
))
!=
0
)
{
newOps
=
intOps
;
sk
.
nioReadyOps
(
newOps
);
return
(
newOps
&
~
oldOps
)
!=
0
;
}
if
(((
ops
&
PollArrayWrapper
.
POLLIN
)
!=
0
)
&&
if
(((
ops
&
Net
.
POLLIN
)
!=
0
)
&&
((
intOps
&
SelectionKey
.
OP_READ
)
!=
0
))
newOps
|=
SelectionKey
.
OP_READ
;
...
...
@@ -105,7 +104,7 @@ class SourceChannelImpl
public
void
translateAndSetInterestOps
(
int
ops
,
SelectionKeyImpl
sk
)
{
if
((
ops
&
SelectionKey
.
OP_READ
)
!=
0
)
ops
=
PollArrayWrapper
.
POLLIN
;
ops
=
Net
.
POLLIN
;
sk
.
selector
.
putEventOps
(
sk
,
ops
);
}
...
...
src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java
浏览文件 @
3d7a9092
...
...
@@ -313,16 +313,16 @@ final class WindowsSelectorImpl extends SelectorImpl {
private
int
processSelectedKeys
(
long
updateCount
)
{
int
numKeysUpdated
=
0
;
numKeysUpdated
+=
processFDSet
(
updateCount
,
readFds
,
PollArrayWrapper
.
POLLIN
,
Net
.
POLLIN
,
false
);
numKeysUpdated
+=
processFDSet
(
updateCount
,
writeFds
,
PollArrayWrapper
.
POLLCONN
|
PollArrayWrapper
.
POLLOUT
,
Net
.
POLLCONN
|
Net
.
POLLOUT
,
false
);
numKeysUpdated
+=
processFDSet
(
updateCount
,
exceptFds
,
PollArrayWrapper
.
POLLIN
|
PollArrayWrapper
.
POLLCONN
|
PollArrayWrapper
.
POLLOUT
,
Net
.
POLLIN
|
Net
.
POLLCONN
|
Net
.
POLLOUT
,
true
);
return
numKeysUpdated
;
}
...
...
src/windows/native/sun/nio/ch/Net.c
浏览文件 @
3d7a9092
...
...
@@ -554,11 +554,11 @@ Java_sun_nio_ch_Net_poll(JNIEnv* env, jclass this, jobject fdo, jint events, jlo
FD_ZERO
(
&
rd
);
FD_ZERO
(
&
wr
);
FD_ZERO
(
&
ex
);
if
(
events
&
sun_nio_ch_PollArrayWrapper_
POLLIN
)
{
if
(
events
&
POLLIN
)
{
FD_SET
(
fd
,
&
rd
);
}
if
(
events
&
sun_nio_ch_PollArrayWrapper_
POLLOUT
||
events
&
sun_nio_ch_PollArrayWrapper_
POLLCONN
)
{
if
(
events
&
POLLOUT
||
events
&
POLLCONN
)
{
FD_SET
(
fd
,
&
wr
);
}
FD_SET
(
fd
,
&
ex
);
...
...
@@ -572,14 +572,50 @@ Java_sun_nio_ch_Net_poll(JNIEnv* env, jclass this, jobject fdo, jint events, jlo
}
else
if
(
rv
>=
0
)
{
rv
=
0
;
if
(
FD_ISSET
(
fd
,
&
rd
))
{
rv
|=
sun_nio_ch_PollArrayWrapper_
POLLIN
;
rv
|=
POLLIN
;
}
if
(
FD_ISSET
(
fd
,
&
wr
))
{
rv
|=
sun_nio_ch_PollArrayWrapper_
POLLOUT
;
rv
|=
POLLOUT
;
}
if
(
FD_ISSET
(
fd
,
&
ex
))
{
rv
|=
sun_nio_ch_PollArrayWrapper_
POLLERR
;
rv
|=
POLLERR
;
}
}
return
rv
;
}
JNIEXPORT
jshort
JNICALL
Java_sun_nio_ch_Net_pollinValue
(
JNIEnv
*
env
,
jclass
this
)
{
return
(
jshort
)
POLLIN
;
}
JNIEXPORT
jshort
JNICALL
Java_sun_nio_ch_Net_polloutValue
(
JNIEnv
*
env
,
jclass
this
)
{
return
(
jshort
)
POLLOUT
;
}
JNIEXPORT
jshort
JNICALL
Java_sun_nio_ch_Net_pollerrValue
(
JNIEnv
*
env
,
jclass
this
)
{
return
(
jshort
)
POLLERR
;
}
JNIEXPORT
jshort
JNICALL
Java_sun_nio_ch_Net_pollhupValue
(
JNIEnv
*
env
,
jclass
this
)
{
return
(
jshort
)
POLLHUP
;
}
JNIEXPORT
jshort
JNICALL
Java_sun_nio_ch_Net_pollnvalValue
(
JNIEnv
*
env
,
jclass
this
)
{
return
(
jshort
)
POLLNVAL
;
}
JNIEXPORT
jshort
JNICALL
Java_sun_nio_ch_Net_pollconnValue
(
JNIEnv
*
env
,
jclass
this
)
{
return
(
jshort
)
POLLCONN
;
}
src/windows/native/sun/nio/ch/WindowsSelectorImpl.c
浏览文件 @
3d7a9092
...
...
@@ -33,13 +33,15 @@
#define FD_SETSIZE 1024
#include <stdlib.h>
#include <winsock2.h>
#include "jvm.h"
#include "jni.h"
#include "jni_util.h"
#include "sun_nio_ch_WindowsSelectorImpl.h"
#include "sun_nio_ch_PollArrayWrapper.h"
#include "winsock2.h"
#include "nio_util.h"
/* Needed for POLL* constants (includes "winsock2.h") */
typedef
struct
{
jint
fd
;
...
...
@@ -79,12 +81,11 @@ Java_sun_nio_ch_WindowsSelectorImpl_00024SubSelector_poll0(JNIEnv *env, jobject
/* Set FD_SET structures required for select */
for
(
i
=
0
;
i
<
numfds
;
i
++
)
{
if
(
fds
[
i
].
events
&
sun_nio_ch_PollArrayWrapper_
POLLIN
)
{
if
(
fds
[
i
].
events
&
POLLIN
)
{
readfds
.
fd_array
[
read_count
]
=
fds
[
i
].
fd
;
read_count
++
;
}
if
(
fds
[
i
].
events
&
(
sun_nio_ch_PollArrayWrapper_POLLOUT
|
sun_nio_ch_PollArrayWrapper_POLLCONN
))
if
(
fds
[
i
].
events
&
(
POLLOUT
|
POLLCONN
))
{
writefds
.
fd_array
[
write_count
]
=
fds
[
i
].
fd
;
write_count
++
;
...
...
@@ -110,12 +111,11 @@ Java_sun_nio_ch_WindowsSelectorImpl_00024SubSelector_poll0(JNIEnv *env, jobject
/* prepare select structures for the i-th socket */
errreadfds
.
fd_count
=
0
;
errwritefds
.
fd_count
=
0
;
if
(
fds
[
i
].
events
&
sun_nio_ch_PollArrayWrapper_
POLLIN
)
{
if
(
fds
[
i
].
events
&
POLLIN
)
{
errreadfds
.
fd_array
[
0
]
=
fds
[
i
].
fd
;
errreadfds
.
fd_count
=
1
;
}
if
(
fds
[
i
].
events
&
(
sun_nio_ch_PollArrayWrapper_POLLOUT
|
sun_nio_ch_PollArrayWrapper_POLLCONN
))
if
(
fds
[
i
].
events
&
(
POLLOUT
|
POLLCONN
))
{
errwritefds
.
fd_array
[
0
]
=
fds
[
i
].
fd
;
errwritefds
.
fd_count
=
1
;
...
...
src/windows/native/sun/nio/ch/nio_util.h
浏览文件 @
3d7a9092
...
...
@@ -23,6 +23,8 @@
* questions.
*/
#include <winsock2.h>
#include "jni.h"
/**
...
...
@@ -55,3 +57,19 @@ struct iovec {
};
#endif
#ifndef POLLIN
/* WSAPoll()/WSAPOLLFD and the corresponding constants are only defined */
/* in Windows Vista / Windows Server 2008 and later. If we are on an */
/* older release we just use the Solaris constants as this was previously */
/* done in PollArrayWrapper.java. */
#define POLLIN 0x0001
#define POLLOUT 0x0004
#define POLLERR 0x0008
#define POLLHUP 0x0010
#define POLLNVAL 0x0020
#define POLLCONN 0x0002
#else
/* POLLCONN must not equal any of the other constants (see winsock2.h). */
#define POLLCONN 0x2000
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录