Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:perform_atomic_semop

Proto:static int perform_atomic_semop(struct sem_array *sma, struct sem_queue *q)

Type:int

Parameter:

TypeParameterName
struct sem_array *sma
struct sem_queue *q
706  sops = array of pending operations
707  nsops = umber of operations
708  un = undo structure
710  If Value for the false possibility is greater at compile time(sops on more than one sem_num ) Then Return perform_atomic_semop[_slow] - Attempt to perform semaphore* operations on a given array
719  When sop < sops + nsops cycle
720  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 )
722  curr = sems[idx]
723  sem_op = semaphore operation
724  result = current value
726  If Not sem_op && result Then Go to would_block
729  result += sem_op
730  If result < 0 Then Go to would_block
733  If result > <= 32767 semaphore maximum value Then Return -ERANGE
745  When sop < sops + nsops cycle
746  curr = sems[semaphore index in array ]
747  sem_op = semaphore operation
748  result = current value
755  current value += sem_op
756  ipc_update_pid( & PID of the process that last modified the semaphore. For* Linux, specifically these are:* - semop* - semctl, via SETVAL and SETALL.* - at task exit when performing undo adjustments (see exit_sem)., process id of requesting process )
759  Return 0
761  would_block :
762  he operation that blocked = sop
763  Return If peration flags & urn error on wait Then -EAGAIN Else 1
Caller
NameDescribe
wake_const_opswake_const_ops - wake up non-alter tasks*@sma: semaphore array.*@semnum: semaphore that was modified.*@wake_q: lockless wake-queue head.* wake_const_ops must be called after a semaphore in a semaphore array* was set to 0
update_queuepdate_queue - look for tasks that can be completed.*@sma: semaphore array.*@semnum: semaphore that was modified.*@wake_q: lockless wake-queue head.* update_queue must be called after a semaphore in a semaphore array* was modified
do_semtimedop