- 追加された行はこの色です。
- 削除された行はこの色です。
*参照元 [#u41288d2]
#backlinks
*説明 [#v65b8885]
-パス: [[linux-2.6.33/fs/file_table.c]]
-FIXME: これは何?
--説明
**引数 [#h1687e98]
-
--
**返り値 [#wd511462]
-
--
**参考 [#n4c6f5b5]
*実装 [#vcd6d128]
/*
* Lightweight file lookup - no refcnt increment if fd table isn't shared.
* You can use this only if it is guranteed that the current task already
* holds a refcnt to that file. That check has to be done at fget() only
* and a flag is returned to be passed to the corresponding fput_light().
* There must not be a cloning between an fget_light/fput_light pair.
*/
struct file *fget_light(unsigned int fd, int *fput_needed)
{
struct file *file;
struct files_struct *files = current->files;
-
--[[linux-2.6.33/file]]
-
--[[linux-2.6.33/files_struct]]
*fput_needed = 0;
if (likely((atomic_read(&files->count) == 1))) {
-ファイルの利用数を増やして 1だったら、つまり最初の利用者だった場合。
-多くの場合、こちらに来ることを期待している。
--[[linux-2.6.33/likely()]]
--[[linux-2.6.33/atomic_read()]]
file = fcheck_files(files, fd);
-
--[[linux-2.6.33/fcheck_files()]]
} else {
rcu_read_lock();
-
--[[linux-2.6.33/rcu_read_lock()]]
file = fcheck_files(files, fd);
-
--[[linux-2.6.33/fcheck_files()]]
if (file) {
if (atomic_long_inc_not_zero(&file->f_count))
*fput_needed = 1;
else
/* Didn't get the reference, someone's freed */
file = NULL;
-
--[[linux-2.6.33/atomic_long_inc_not_zero()]]
}
rcu_read_unlock();
-
--[[linux-2.6.33/rcu_read_unlock()]]
}
return file;
}
*コメント [#s720c8b8]