函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:allocate a file descriptor, mark it busy.

函数原型:int __alloc_fd(struct files_struct *files, unsigned start, unsigned end, unsigned flags)

返回类型:int

参数:

类型参数名称
struct files_struct *files
unsignedstart
unsignedend
unsignedflags
487  加自旋锁
488  repeat :
489  fdt等于files_fdtable(files)
490  fd等于start
491  如果fd小于next_fdfd等于next_fd
494  如果fd小于max_fdsfd等于find_next_fd(fdt, fd)
501  error等于负EMFILE
502  如果fd大于等于end则转到:out
505  error等于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
506  如果error小于0则转到:out
513  如果error则转到:repeat
516  如果start小于等于next_fdnext_fd等于fd加1
519  __set_open_fd(fd, fdt)
520  如果flags按位与O_CLOEXEC__set_close_on_exec(fd, fdt)
522  否则__clear_close_on_exec(fd, fdt)
524  error等于fd
527  如果(cu_access_pointer() - fetch RCU pointer with no dereferencing*@p: The pointer to read* Return the value of the specified RCU-protected pointer, but omit the* lockdep checks for being in an RCU read-side critical section( current fd array [fd]) != NULL)则
528  printk - print a kernel message*@fmt: format string* This is printk(). It can be called from any context. We want it to work.* We try to grab the console_lock. If we succeed, it's easy - we log the* output and call the console drivers
529  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)
533  out :
534  自旋锁解锁
535  返回:error
调用者
名称描述
alloc_fd
get_unused_fd_flags