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:do_dup2

Proto:static int do_dup2(struct files_struct *files, struct file *file, unsigned fd, unsigned flags)__releases(&files->file_lock)

Type:int

Parameter:

TypeParameterName
struct files_struct *files
struct file *file
unsignedfd
unsignedflags
864  fdt = files_fdtable(files)
865  tofree = current fd array [fd]
866  If Not tofree && fd_is_open(fd, fdt) Then Go to Ebusy
868  get_file(file)
869  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], file)
870  __set_open_fd(fd, fdt)
871  If flags & O_CLOEXEC Then __set_close_on_exec(fd, fdt)
873  Else __clear_close_on_exec(fd, fdt)
875  spin_unlock( & written part on a separate cache line in SMP)
877  If tofree Then "id" is the POSIX thread ID. We use the* files pointer for this..
880  Return fd
882  Ebusy :
883  spin_unlock( & written part on a separate cache line in SMP)
884  Return -EBUSY
Caller
NameDescribe
replace_fd
ksys_dup3