Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\file.c Create Date:2022-07-28 20:08:32
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:The same warnings as for __alloc_fd()/__fd_install() apply here...

Proto:int __close_fd(struct files_struct *files, unsigned fd)

Type:int

Parameter:

TypeParameterName
struct files_struct *files
unsignedfd
626  spin_lock( & written part on a separate cache line in SMP)
627  fdt = files_fdtable(files)
628  If fd >= max_fds Then Go to out_unlock
630  file = current fd array [fd]
631  If Not file Then Go to 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  spin_unlock( & written part on a separate cache line in SMP)
636  Return "id" is the POSIX thread ID. We use the* files pointer for this..
638  out_unlock :
639  spin_unlock( & written part on a separate cache line in SMP)
640  Return -EBADF
Caller
NameDescribe
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.