Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
7e3fb584
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
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看板
提交
7e3fb584
编写于
8月 30, 2013
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
switch epoll_ctl() to fdget
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
a2e0578b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
15 addition
and
16 deletion
+15
-16
fs/eventpoll.c
fs/eventpoll.c
+15
-16
未找到文件。
fs/eventpoll.c
浏览文件 @
7e3fb584
...
...
@@ -1792,7 +1792,7 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
{
int
error
;
int
did_lock_epmutex
=
0
;
struct
f
ile
*
file
,
*
tfile
;
struct
f
d
f
,
tf
;
struct
eventpoll
*
ep
;
struct
epitem
*
epi
;
struct
epoll_event
epds
;
...
...
@@ -1802,20 +1802,19 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
copy_from_user
(
&
epds
,
event
,
sizeof
(
struct
epoll_event
)))
goto
error_return
;
/* Get the "struct file *" for the eventpoll file */
error
=
-
EBADF
;
f
ile
=
f
get
(
epfd
);
if
(
!
file
)
f
=
fd
get
(
epfd
);
if
(
!
f
.
f
ile
)
goto
error_return
;
/* Get the "struct file *" for the target file */
tf
ile
=
f
get
(
fd
);
if
(
!
tfile
)
tf
=
fd
get
(
fd
);
if
(
!
tf
.
f
ile
)
goto
error_fput
;
/* The target file descriptor must support poll */
error
=
-
EPERM
;
if
(
!
tf
ile
->
f_op
||
!
t
file
->
f_op
->
poll
)
if
(
!
tf
.
file
->
f_op
||
!
tf
.
file
->
f_op
->
poll
)
goto
error_tgt_fput
;
/* Check if EPOLLWAKEUP is allowed */
...
...
@@ -1828,14 +1827,14 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
* adding an epoll file descriptor inside itself.
*/
error
=
-
EINVAL
;
if
(
f
ile
==
tfile
||
!
is_file_epoll
(
file
))
if
(
f
.
file
==
tf
.
file
||
!
is_file_epoll
(
f
.
file
))
goto
error_tgt_fput
;
/*
* At this point it is safe to assume that the "private_data" contains
* our own data structure.
*/
ep
=
file
->
private_data
;
ep
=
f
.
f
ile
->
private_data
;
/*
* When we insert an epoll file descriptor, inside another epoll file
...
...
@@ -1854,14 +1853,14 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
did_lock_epmutex
=
1
;
}
if
(
op
==
EPOLL_CTL_ADD
)
{
if
(
is_file_epoll
(
tfile
))
{
if
(
is_file_epoll
(
tf
.
f
ile
))
{
error
=
-
ELOOP
;
if
(
ep_loop_check
(
ep
,
tfile
)
!=
0
)
{
if
(
ep_loop_check
(
ep
,
tf
.
f
ile
)
!=
0
)
{
clear_tfile_check_list
();
goto
error_tgt_fput
;
}
}
else
list_add
(
&
tfile
->
f_tfile_llink
,
&
tfile_check_list
);
list_add
(
&
tf
.
f
ile
->
f_tfile_llink
,
&
tfile_check_list
);
}
mutex_lock_nested
(
&
ep
->
mtx
,
0
);
...
...
@@ -1871,14 +1870,14 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
* above, we can be sure to be able to use the item looked up by
* ep_find() till we release the mutex.
*/
epi
=
ep_find
(
ep
,
tfile
,
fd
);
epi
=
ep_find
(
ep
,
tf
.
f
ile
,
fd
);
error
=
-
EINVAL
;
switch
(
op
)
{
case
EPOLL_CTL_ADD
:
if
(
!
epi
)
{
epds
.
events
|=
POLLERR
|
POLLHUP
;
error
=
ep_insert
(
ep
,
&
epds
,
tfile
,
fd
);
error
=
ep_insert
(
ep
,
&
epds
,
tf
.
f
ile
,
fd
);
}
else
error
=
-
EEXIST
;
clear_tfile_check_list
();
...
...
@@ -1903,9 +1902,9 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
if
(
did_lock_epmutex
)
mutex_unlock
(
&
epmutex
);
f
put
(
tfile
);
f
dput
(
tf
);
error_fput:
f
put
(
file
);
f
dput
(
f
);
error_return:
return
error
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录