函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\locks.c Create Date:2022-07-29 10:59:42
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_setlk64(unsigned int fd, struct file *filp, unsigned int cmd, struct flock64 *flock)

返回类型:int

参数:

类型参数名称
unsigned intfd
struct file *filp
unsigned intcmd
struct flock64 *flock
2578  file_lock等于Allocate an empty lock structure.
2579  inode等于locks_inode(filp)
2583  如果(file_lock == NULL)则返回:负ENOLCK
2589  如果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
2590  error等于负EAGAIN
2591  转到:out
2594  error等于flock64_to_posix_lock(filp, file_lock, flock)
2595  如果error则转到:out
2598  error等于Ensure that fl->fl_file has compatible f_mode for F_SETLK calls
2599  如果error则转到:out
2607  :cmd恒等于F_OFD_SETLK
2608  error等于负EINVAL
2609  如果l_pid不等于0则转到:out
2612  cmd等于F_SETLK64
2613  fl_flags或等于lock is "owned" by struct file
2614  fl_owner等于filp
2615  退出
2616  :cmd恒等于F_OFD_SETLKW
2617  error等于负EINVAL
2618  如果l_pid不等于0则转到:out
2621  cmd等于F_SETLKW64
2622  fl_flags或等于lock is "owned" by struct file
2623  fl_owner等于filp
2625  :cmd恒等于F_SETLKW64
2626  fl_flags或等于A blocking lock
2629  error等于do_lock_file_wait(filp, cmd, file_lock)
2636  如果非errorfl_type不等于F_UNLCK且非fl_flags按位与lock is "owned" by struct file 的值则
2643  加自旋锁
2644  f等于Check whether the specified fd has an open file.(fd)
2645  自旋锁解锁
2646  如果f不等于filp
2647  fl_type等于F_UNLCK
2650  error等于负EBADF
2653  out :
2654  Free a lock which is not in use.
2655  返回:error