函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\futex.c Create Date:2022-07-27 11:53:46
Last Modify:2020-03-17 15:28:32 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:Lookup the task for the TID provided from user space and attach to* it after doing proper sanity checks.

函数原型:static int attach_to_pi_owner(unsigned int __user *uaddr, unsigned int uval, union futex_key *key, struct futex_pi_state **ps, struct task_struct **exiting)

返回类型:int

参数:

类型参数名称
unsigned int __user *uaddr
unsigned intuval
union futex_key *key
struct futex_pi_state **ps
struct task_struct **exiting
1274  pid等于uval按位与The rest of the robust-futex field is for the TID:
1285  如果非pid则返回:负EAGAIN
1287  p等于find_get_task_by_vpid(pid)
1288  如果非p则返回:handle_exit_race(uaddr, uval, NULL)
1291  如果此条件成立可能性小(为编译器优化)(任务标志 & I am a kernel thread )则
1292  put_task_struct(p)
1293  返回:负EPERM
1301  关闭本地中断,获取所要保护的运行队列(runqueue)的自旋锁(spinlock),为查找可运行进程做准备。( & Protection of the PI data structures: )
1302  如果此条件成立可能性小(为编译器优化)(futex_state != FUTEX_STATE_OK)则
1308  ret等于handle_exit_race(uaddr, uval, p)
1310  raw_spin_unlock_irq( & Protection of the PI data structures: )
1320  如果ret恒等于负EBUSYexiting等于p
1322  否则put_task_struct(p)
1324  返回:ret
1333  pi_state等于alloc_pi_state()
1339  _mutex_init_proxy_locked - initialize and lock a rt_mutex on behalf of a* proxy owner*@lock: the rt_mutex to be locked*@proxy_owner:the task to set as owner* No locking. Caller has to do serializing itself* Special API call for PI-futex support
1342  key等于key
1344  WARN_ON(!链表为空)
1345  添加链表项
1350  owner等于p
1351  raw_spin_unlock_irq( & Protection of the PI data structures: )
1353  put_task_struct(p)
1355  ps等于pi_state
1357  返回:0
调用者
名称描述
lookup_pi_state
futex_lock_pi_atomicex_lock_pi_atomic() - Atomic work required to acquire a pi aware futex*@uaddr: the pi futex user address*@hb: the pi futex hash bucket*@key: the futex key associated with uaddr and hb*@ps: the pi_state pointer where we store the result of the* lookup