linux-4.4.1/__fd_install()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#ff592b0a]
#backlinks
*説明 [#vca44a18]
-パス: [[linux-4.4.1/fs/file.c]]
-FIXME: これは何?
--説明
**引数 [#a23a0ff2]
-struct files_struct *files
--
--[[linux-4.4.1/files_struct]]
-unsigned int fd
--
-struct file *file
--
--[[linux-4.4.1/file]]
**返り値 [#l0d33d53]
-なし
**参考 [#b383a3fb]
*実装 [#xb5a1412]
/*
* Install a file pointer in the fd array.
*
* The VFS is full of places where we drop the files loc...
* setting the open_fds bitmap and installing the file i...
* array. At any such point, we are vulnerable to a dup...
* installing a file in the array before us. We need to...
* fput() the struct file we are about to overwrite in t...
*
* It should never happen - if we allow dup2() do it, _r...
* will follow.
*
* NOTE: __fd_install() variant is really, really low-le...
* use it unless you are forced to by truly lousy API sh...
* your throat. 'files' *MUST* be either current->files...
* by get_files_struct(current) done by whoever had give...
* or really bad things will happen. Normally you want ...
* fd_install() instead.
*/
void __fd_install(struct files_struct *files, unsigned i...
struct file *file)
{
struct fdtable *fdt;
-
--[[linux-4.4.1/fdtable]]
might_sleep();
rcu_read_lock_sched();
-
--[[linux-4.4.1/might_sleep()]]
--[[linux-4.4.1/rcu_read_lock_sched()]]
while (unlikely(files->resize_in_progress)) {
rcu_read_unlock_sched();
wait_event(files->resize_wait, !files->r...
rcu_read_lock_sched();
}
-
--[[linux-4.4.1/unlikely()]]
--[[linux-4.4.1/rcu_read_unlock_sched()]]
--[[linux-4.4.1/wait_event()]]
/* coupled with smp_wmb() in expand_fdtable() */
smp_rmb();
fdt = rcu_dereference_sched(files->fdt);
BUG_ON(fdt->fd[fd] != NULL);
rcu_assign_pointer(fdt->fd[fd], file);
rcu_read_unlock_sched();
-
--[[linux-4.4.1/smp_rmb()]]
--[[linux-4.4.1/rcu_dereference_sched()]]
--[[linux-4.4.1/BUG_ON()]]
--[[linux-4.4.1/rcu_assign_pointer()]]
}
*コメント [#td5a0876]
終了行:
*参照元 [#ff592b0a]
#backlinks
*説明 [#vca44a18]
-パス: [[linux-4.4.1/fs/file.c]]
-FIXME: これは何?
--説明
**引数 [#a23a0ff2]
-struct files_struct *files
--
--[[linux-4.4.1/files_struct]]
-unsigned int fd
--
-struct file *file
--
--[[linux-4.4.1/file]]
**返り値 [#l0d33d53]
-なし
**参考 [#b383a3fb]
*実装 [#xb5a1412]
/*
* Install a file pointer in the fd array.
*
* The VFS is full of places where we drop the files loc...
* setting the open_fds bitmap and installing the file i...
* array. At any such point, we are vulnerable to a dup...
* installing a file in the array before us. We need to...
* fput() the struct file we are about to overwrite in t...
*
* It should never happen - if we allow dup2() do it, _r...
* will follow.
*
* NOTE: __fd_install() variant is really, really low-le...
* use it unless you are forced to by truly lousy API sh...
* your throat. 'files' *MUST* be either current->files...
* by get_files_struct(current) done by whoever had give...
* or really bad things will happen. Normally you want ...
* fd_install() instead.
*/
void __fd_install(struct files_struct *files, unsigned i...
struct file *file)
{
struct fdtable *fdt;
-
--[[linux-4.4.1/fdtable]]
might_sleep();
rcu_read_lock_sched();
-
--[[linux-4.4.1/might_sleep()]]
--[[linux-4.4.1/rcu_read_lock_sched()]]
while (unlikely(files->resize_in_progress)) {
rcu_read_unlock_sched();
wait_event(files->resize_wait, !files->r...
rcu_read_lock_sched();
}
-
--[[linux-4.4.1/unlikely()]]
--[[linux-4.4.1/rcu_read_unlock_sched()]]
--[[linux-4.4.1/wait_event()]]
/* coupled with smp_wmb() in expand_fdtable() */
smp_rmb();
fdt = rcu_dereference_sched(files->fdt);
BUG_ON(fdt->fd[fd] != NULL);
rcu_assign_pointer(fdt->fd[fd], file);
rcu_read_unlock_sched();
-
--[[linux-4.4.1/smp_rmb()]]
--[[linux-4.4.1/rcu_dereference_sched()]]
--[[linux-4.4.1/BUG_ON()]]
--[[linux-4.4.1/rcu_assign_pointer()]]
}
*コメント [#td5a0876]
ページ名: