Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:ipc\sem.c Create Date:2022-07-28 16:43:26
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

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

Proto:static inline int sem_lock(struct sem_array *sma, struct sembuf *sops, int nsops)

Type:int

Parameter:

TypeParameterName
struct sem_array *sma
struct sembuf *sops
intnsops
373  If nsops != 1 Then
375  ipc_lock_object( & permissions .. see ipc.h )
378  Enter the mode suitable for non-simple operations:* Caller must own sem_perm.lock.
379  Return 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  If Not >0: global lock required Then
401  spin_lock( & spinlock for fine-grained semtimedop )
408  spin_unlock( & spinlock for fine-grained semtimedop )
412  ipc_lock_object( & permissions .. see ipc.h )
414  If >0: global lock required == 0 Then
424  spin_lock( & spinlock for fine-grained semtimedop )
426  ipc_unlock_object( & permissions .. see ipc.h )
427  Return semaphore index in array
428  Else
434  Return SEM_GLOBAL_LOCK
Caller
NameDescribe
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