Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
68e7bf17
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看板
提交
68e7bf17
编写于
5月 07, 2012
作者:
Z
zhouyx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7166048: Remove the embeded epoll data structure.
Reviewed-by: alanb
上级
c0e0b6ca
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
5 addition
and
55 deletion
+5
-55
src/solaris/native/sun/nio/ch/EPollArrayWrapper.c
src/solaris/native/sun/nio/ch/EPollArrayWrapper.c
+5
-55
未找到文件。
src/solaris/native/sun/nio/ch/EPollArrayWrapper.c
浏览文件 @
68e7bf17
...
...
@@ -30,40 +30,10 @@
#include "sun_nio_ch_EPollArrayWrapper.h"
#include <dlfcn.h>
#include <unistd.h>
#include <sys/resource.h>
#include <sys/time.h>
#ifdef __cplusplus
extern
"C"
{
#endif
/* epoll_wait(2) man page */
typedef
union
epoll_data
{
void
*
ptr
;
int
fd
;
__uint32_t
u32
;
__uint64_t
u64
;
}
epoll_data_t
;
/* x86-64 has same alignment as 32-bit */
#ifdef __x86_64__
#define EPOLL_PACKED __attribute__((packed))
#else
#define EPOLL_PACKED
#endif
struct
epoll_event
{
__uint32_t
events
;
/* Epoll events */
epoll_data_t
data
;
/* User data variable */
}
EPOLL_PACKED
;
#ifdef __cplusplus
}
#endif
#include <sys/epoll.h>
#define RESTARTABLE(_cmd, _result) do { \
do { \
...
...
@@ -71,18 +41,6 @@ struct epoll_event {
} while((_result == -1) && (errno == EINTR)); \
} while(0)
/*
* epoll event notification is new in 2.6 kernel. As the offical build
* platform for the JDK is on a 2.4-based distribution then we must
* obtain the addresses of the epoll functions dynamically.
*/
typedef
int
(
*
epoll_create_t
)(
int
size
);
typedef
int
(
*
epoll_ctl_t
)
(
int
epfd
,
int
op
,
int
fd
,
struct
epoll_event
*
event
);
typedef
int
(
*
epoll_wait_t
)
(
int
epfd
,
struct
epoll_event
*
events
,
int
maxevents
,
int
timeout
);
static
epoll_create_t
epoll_create_func
;
static
epoll_ctl_t
epoll_ctl_func
;
static
epoll_wait_t
epoll_wait_func
;
static
int
iepoll
(
int
epfd
,
struct
epoll_event
*
events
,
int
numfds
,
jlong
timeout
)
...
...
@@ -96,7 +54,7 @@ iepoll(int epfd, struct epoll_event *events, int numfds, jlong timeout)
start
=
t
.
tv_sec
*
1000
+
t
.
tv_usec
/
1000
;
for
(;;)
{
int
res
=
(
*
epoll_wait_func
)
(
epfd
,
events
,
numfds
,
timeout
);
int
res
=
epoll_wait
(
epfd
,
events
,
numfds
,
timeout
);
if
(
res
<
0
&&
errno
==
EINTR
)
{
if
(
remaining
>=
0
)
{
gettimeofday
(
&
t
,
NULL
);
...
...
@@ -117,14 +75,6 @@ iepoll(int epfd, struct epoll_event *events, int numfds, jlong timeout)
JNIEXPORT
void
JNICALL
Java_sun_nio_ch_EPollArrayWrapper_init
(
JNIEnv
*
env
,
jclass
this
)
{
epoll_create_func
=
(
epoll_create_t
)
dlsym
(
RTLD_DEFAULT
,
"epoll_create"
);
epoll_ctl_func
=
(
epoll_ctl_t
)
dlsym
(
RTLD_DEFAULT
,
"epoll_ctl"
);
epoll_wait_func
=
(
epoll_wait_t
)
dlsym
(
RTLD_DEFAULT
,
"epoll_wait"
);
if
((
epoll_create_func
==
NULL
)
||
(
epoll_ctl_func
==
NULL
)
||
(
epoll_wait_func
==
NULL
))
{
JNU_ThrowInternalError
(
env
,
"unable to get address of epoll functions, pre-2.6 kernel?"
);
}
}
JNIEXPORT
jint
JNICALL
...
...
@@ -134,7 +84,7 @@ Java_sun_nio_ch_EPollArrayWrapper_epollCreate(JNIEnv *env, jobject this)
* epoll_create expects a size as a hint to the kernel about how to
* dimension internal structures. We can't predict the size in advance.
*/
int
epfd
=
(
*
epoll_create_func
)
(
256
);
int
epfd
=
epoll_create
(
256
);
if
(
epfd
<
0
)
{
JNU_ThrowIOExceptionWithLastError
(
env
,
"epoll_create failed"
);
}
...
...
@@ -173,7 +123,7 @@ Java_sun_nio_ch_EPollArrayWrapper_epollCtl(JNIEnv *env, jobject this, jint epfd,
event
.
events
=
events
;
event
.
data
.
fd
=
fd
;
RESTARTABLE
(
(
*
epoll_ctl_func
)
(
epfd
,
(
int
)
opcode
,
(
int
)
fd
,
&
event
),
res
);
RESTARTABLE
(
epoll_ctl
(
epfd
,
(
int
)
opcode
,
(
int
)
fd
,
&
event
),
res
);
/*
* A channel may be registered with several Selectors. When each Selector
...
...
@@ -199,7 +149,7 @@ Java_sun_nio_ch_EPollArrayWrapper_epollWait(JNIEnv *env, jobject this,
int
res
;
if
(
timeout
<=
0
)
{
/* Indefinite or no wait */
RESTARTABLE
(
(
*
epoll_wait_func
)
(
epfd
,
events
,
numfds
,
timeout
),
res
);
RESTARTABLE
(
epoll_wait
(
epfd
,
events
,
numfds
,
timeout
),
res
);
}
else
{
/* Bounded wait; bounded restarts */
res
=
iepoll
(
epfd
,
events
,
numfds
,
timeout
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录