函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\file.c Create Date:2022-07-29 10:38:45
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:The same warnings as for __alloc_fd()/__fd_install() apply here...

函数原型:int __close_fd(struct files_struct *files, unsigned fd)

返回类型:int

参数:

类型参数名称
struct files_struct *files
unsignedfd
626  加自旋锁
627  fdt等于files_fdtable(files)
628  如果fd大于等于max_fds则转到:out_unlock
630  file等于 current fd array [fd]
631  如果非file则转到:out_unlock
633  cu_assign_pointer() - assign to RCU-protected pointer*@p: pointer to assign to*@v: value to assign (publish)* Assigns the specified value to the specified RCU-protected* pointer, ensuring that any concurrent RCU readers will see* any prior initialization( current fd array [fd], NULL)
634  __put_unused_fd(files, fd)
635  自旋锁解锁
636  返回:"id" is the POSIX thread ID. We use the* files pointer for this..
638  out_unlock :
639  自旋锁解锁
640  返回:负EBADF
调用者
名称描述
replace_fd
ksys_closeIn contrast to sys_close(), this stub does not check whether the syscall* should or should not be restarted, but returns the raw error codes from* __close_fd().
SYSCALL_DEFINE1Careful here! We test whether the file pointer is NULL before* releasing the fd. This ensures that one clone task can't release* an fd while another clone is opening it.