Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
58e41a44
K
Kernel
项目概览
openeuler
/
Kernel
2 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
58e41a44
编写于
1月 08, 2020
作者:
J
Jens Axboe
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
eventpoll: abstract out epoll_ctl() handler
No functional changes in this patch. Signed-off-by:
N
Jens Axboe
<
axboe@kernel.dk
>
上级
f86cd20c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
20 deletion
+25
-20
fs/eventpoll.c
fs/eventpoll.c
+25
-20
未找到文件。
fs/eventpoll.c
浏览文件 @
58e41a44
...
...
@@ -2074,27 +2074,15 @@ SYSCALL_DEFINE1(epoll_create, int, size)
return
do_epoll_create
(
0
);
}
/*
* The following function implements the controller interface for
* the eventpoll file that enables the insertion/removal/change of
* file descriptors inside the interest set.
*/
SYSCALL_DEFINE4
(
epoll_ctl
,
int
,
epfd
,
int
,
op
,
int
,
fd
,
struct
epoll_event
__user
*
,
event
)
static
int
do_epoll_ctl
(
int
epfd
,
int
op
,
int
fd
,
struct
epoll_event
*
epds
)
{
int
error
;
int
full_check
=
0
;
struct
fd
f
,
tf
;
struct
eventpoll
*
ep
;
struct
epitem
*
epi
;
struct
epoll_event
epds
;
struct
eventpoll
*
tep
=
NULL
;
error
=
-
EFAULT
;
if
(
ep_op_has_event
(
op
)
&&
copy_from_user
(
&
epds
,
event
,
sizeof
(
struct
epoll_event
)))
goto
error_return
;
error
=
-
EBADF
;
f
=
fdget
(
epfd
);
if
(
!
f
.
file
)
...
...
@@ -2112,7 +2100,7 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
/* Check if EPOLLWAKEUP is allowed */
if
(
ep_op_has_event
(
op
))
ep_take_care_of_epollwakeup
(
&
epds
);
ep_take_care_of_epollwakeup
(
epds
);
/*
* We have to check that the file structure underneath the file descriptor
...
...
@@ -2128,11 +2116,11 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
* so EPOLLEXCLUSIVE is not allowed for a EPOLL_CTL_MOD operation.
* Also, we do not currently supported nested exclusive wakeups.
*/
if
(
ep_op_has_event
(
op
)
&&
(
epds
.
events
&
EPOLLEXCLUSIVE
))
{
if
(
ep_op_has_event
(
op
)
&&
(
epds
->
events
&
EPOLLEXCLUSIVE
))
{
if
(
op
==
EPOLL_CTL_MOD
)
goto
error_tgt_fput
;
if
(
op
==
EPOLL_CTL_ADD
&&
(
is_file_epoll
(
tf
.
file
)
||
(
epds
.
events
&
~
EPOLLEXCLUSIVE_OK_BITS
)))
(
epds
->
events
&
~
EPOLLEXCLUSIVE_OK_BITS
)))
goto
error_tgt_fput
;
}
...
...
@@ -2192,8 +2180,8 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
switch
(
op
)
{
case
EPOLL_CTL_ADD
:
if
(
!
epi
)
{
epds
.
events
|=
EPOLLERR
|
EPOLLHUP
;
error
=
ep_insert
(
ep
,
&
epds
,
tf
.
file
,
fd
,
full_check
);
epds
->
events
|=
EPOLLERR
|
EPOLLHUP
;
error
=
ep_insert
(
ep
,
epds
,
tf
.
file
,
fd
,
full_check
);
}
else
error
=
-
EEXIST
;
if
(
full_check
)
...
...
@@ -2208,8 +2196,8 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
case
EPOLL_CTL_MOD
:
if
(
epi
)
{
if
(
!
(
epi
->
event
.
events
&
EPOLLEXCLUSIVE
))
{
epds
.
events
|=
EPOLLERR
|
EPOLLHUP
;
error
=
ep_modify
(
ep
,
epi
,
&
epds
);
epds
->
events
|=
EPOLLERR
|
EPOLLHUP
;
error
=
ep_modify
(
ep
,
epi
,
epds
);
}
}
else
error
=
-
ENOENT
;
...
...
@@ -2231,6 +2219,23 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
return
error
;
}
/*
* The following function implements the controller interface for
* the eventpoll file that enables the insertion/removal/change of
* file descriptors inside the interest set.
*/
SYSCALL_DEFINE4
(
epoll_ctl
,
int
,
epfd
,
int
,
op
,
int
,
fd
,
struct
epoll_event
__user
*
,
event
)
{
struct
epoll_event
epds
;
if
(
ep_op_has_event
(
op
)
&&
copy_from_user
(
&
epds
,
event
,
sizeof
(
struct
epoll_event
)))
return
-
EFAULT
;
return
do_epoll_ctl
(
epfd
,
op
,
fd
,
&
epds
);
}
/*
* Implement the event wait interface for the eventpoll file. It is the kernel
* part of the user space epoll_wait(2).
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录