函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:ipc\sem.c Create Date:2022-07-27 18:18:39
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:If the request contains only one semaphore operation, and there are* no complex transactions pending, lock only the semaphore involved

函数原型:static inline int sem_lock(struct sem_array *sma, struct sembuf *sops, int nsops)

返回类型:int

参数:

类型参数名称
struct sem_array *sma
struct sembuf *sops
intnsops
373  如果nsops不等于1则
375  ipc_lock_object( & permissions .. see ipc.h )
378  Enter the mode suitable for non-simple operations:* Caller must own sem_perm.lock.
379  返回:SEM_GLOBAL_LOCK
389  idx等于array_index_nospec - sanitize an array index after a bounds check* For a code sequence like:* if (index < size) {* index = array_index_nospec(index, size);* val = array[index];* }* (semaphore index in array , . of semaphores in array )
390  sem等于sems[idx]
396  如果非>0: global lock required
401  加自旋锁
408  自旋锁解锁
412  ipc_lock_object( & permissions .. see ipc.h )
414  如果>0: global lock required 恒等于0则
424  加自旋锁
426  ipc_unlock_object( & permissions .. see ipc.h )
427  返回:semaphore index in array
428  否则
434  返回:SEM_GLOBAL_LOCK
调用者
名称描述
sem_lock_and_putref
semctl_setval
semctl_main
semctl_downThis function handles some semctl commands which require the rwsem* to be held in write mode.* NOTE: no locks must be held, the rwsem is taken inside this function.
do_semtimedop
exit_semadd semadj values to semaphores, free undo structures