Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Expand files.* This function will expand the file structures, if the requested size exceeds* the current capacity and there is room for expansion.* Return <0 error code on error; 0 when nothing done; 1 when files were

Proto:static int expand_files(struct files_struct *files, unsigned int nr)__releases(files->file_lock) __acquires(files->file_lock)

Type:int

Parameter:

TypeParameterName
struct files_struct *files
unsigned intnr
198  expanded = 0
200  repeat :
201  fdt = files_fdtable(files)
204  If nr < max_fds Then Return expanded
208  If nr >= sysctl_nr_open Then Return -EMFILE
211  If Value for the false possibility is greater at compile time(resize_in_progress) Then
212  spin_unlock( & written part on a separate cache line in SMP)
213  expanded = 1
214  wait_event - sleep until a condition gets true*@wq_head: the waitqueue to wait on*@condition: a C expression for the event to wait for* The process is put to sleep (TASK_UNINTERRUPTIBLE) until the*@condition evaluates to true(resize_wait, !resize_in_progress)
215  spin_lock( & written part on a separate cache line in SMP)
216  Go to repeat
220  resize_in_progress = true
221  expanded = Expand the file descriptor table.* This function will allocate a new fdtable and both fd array and fdset, of* the given size.* Return <0 error code on error; 1 on successful completion.
222  resize_in_progress = false
224  wake_up_all( & resize_wait)
225  Return expanded
Caller
NameDescribe
__alloc_fdallocate a file descriptor, mark it busy.
replace_fd
ksys_dup3