函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Validate that the existing waiter has a pi_state and sanity check* the pi_state against the user space value. If correct, attach to* it.

函数原型:static int attach_to_pi_state(unsigned int __user *uaddr, unsigned int uval, struct futex_pi_state *pi_state, struct futex_pi_state **ps)

返回类型:int

参数:

类型参数名称
unsigned int __user *uaddr
unsigned intuval
struct futex_pi_state *pi_state
struct futex_pi_state **ps
1065  pid等于uval按位与The rest of the robust-futex field is for the TID:
1072  如果此条件成立可能性小(为编译器优化)(!pi_state)则返回:负EINVAL
1087  WARN_ON(!_read - get a refcount's value*@r: the refcount* Return: the refcount's value)
1093  关闭本地中断,获取所要保护的运行队列(runqueue)的自旋锁(spinlock),为查找可运行进程做准备。( & 保护自旋锁)
1101  如果get_futex_value_locked( & uval2, uaddr)则转到:out_efault
1104  如果uval不等于uval2则转到:out_eagain
1110  如果uval按位与The kernel signals via this bit that a thread holding a futex* has exited without unlocking the futex. The kernel also does* a FUTEX_WAKE on such futexes, after setting the bit, to wake* up any possible waiters:
1116  如果非owner
1121  如果pid则转到:out_einval
1126  转到:out_attach
1137  如果非pid则转到:out_attach
1139  否则
1144  如果非owner则转到:out_einval
1153  如果pid不等于task_pid_vnr(owner)则转到:out_einval
1156  out_attach :
1157  get_pi_state(pi_state)
1158  raw_spin_unlock_irq( & 保护自旋锁)
1159  ps等于pi_state
1160  返回:0
1162  out_einval :
1163  ret等于负EINVAL
1164  转到:out_error
1166  out_eagain :
1167  ret等于负EAGAIN
1168  转到:out_error
1170  out_efault :
1171  ret等于负EFAULT
1172  转到:out_error
1174  out_error :
1175  raw_spin_unlock_irq( & 保护自旋锁)
1176  返回:ret
调用者
名称描述
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