函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Apply the lock described by l to an open file descriptor.* This implements both the F_SETLK and F_SETLKW commands of fcntl().

函数原型:int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd, struct flock *flock)

返回类型:int

参数:

类型参数名称
unsigned intfd
struct file *filp
unsigned intcmd
struct flock *flock
2447  file_lock等于Allocate an empty lock structure.
2448  inode等于locks_inode(filp)
2452  如果(file_lock == NULL)则返回:负ENOLCK
2458  如果mandatory_lock(inode)且Might pages of this file have been modified in userspace?* Note that i_mmap_writable counts all VM_SHARED vmas: do_mmap_pgoff* marks vma as VM_SHARED if it is shared, and the file was opened for* writing i
2459  error等于负EAGAIN
2460  转到:out
2463  error等于Verify a "struct flock" and copy it to a "struct file_lock" as a POSIX* style lock.
2464  如果error则转到:out
2467  error等于Ensure that fl->fl_file has compatible f_mode for F_SETLK calls
2468  如果error则转到:out
2476  :cmd恒等于F_OFD_SETLK
2477  error等于负EINVAL
2478  如果l_pid不等于0则转到:out
2481  cmd等于F_SETLK
2482  fl_flags或等于lock is "owned" by struct file
2483  fl_owner等于filp
2484  退出
2485  :cmd恒等于F_OFD_SETLKW
2486  error等于负EINVAL
2487  如果l_pid不等于0则转到:out
2490  cmd等于F_SETLKW
2491  fl_flags或等于lock is "owned" by struct file
2492  fl_owner等于filp
2494  :cmd恒等于F_SETLKW
2495  fl_flags或等于A blocking lock
2498  error等于do_lock_file_wait(filp, cmd, file_lock)
2505  如果非errorfl_type不等于F_UNLCK且非fl_flags按位与lock is "owned" by struct file 的值则
2512  加自旋锁
2513  f等于Check whether the specified fd has an open file.(fd)
2514  自旋锁解锁
2515  如果f不等于filp
2516  fl_type等于F_UNLCK
2519  error等于负EBADF
2522  out :
2523  trace_fcntl_setlk(inode, file_lock, error)
2524  Free a lock which is not in use.
2525  返回:error
调用者
名称描述
do_compat_fcntl64