Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:perform_atomic_semop[_slow] - Attempt to perform semaphore* operations on a given array

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

Type:int

Parameter:

TypeParameterName
struct sem_array *sma
struct sem_queue *q
634  sops = array of pending operations
635  nsops = umber of operations
636  un = undo structure
638  When sop < sops + nsops cycle
639  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 )
640  curr = sems[idx]
641  sem_op = semaphore operation
642  result = current value
644  If Not sem_op && result Then Go to would_block
647  result += sem_op
648  If result < 0 Then Go to would_block
650  If result > <= 32767 semaphore maximum value Then Go to out_of_range
661  current value = result
664  sop--
665  pid = process id of requesting process
666  When sop >= sops cycle
667  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)., pid)
668  sop--
671  Return 0
673  out_of_range :
674  result = -ERANGE
675  Go to undo
677  would_block :
678  he operation that blocked = sop
680  If peration flags & urn error on wait Then result = -EAGAIN
682  Else result = 1
685  undo :
686  sop--
687  When sop >= sops cycle
688  sem_op = semaphore operation
689  current value -= sem_op
690  If peration flags & undo the operation on exit Then array of adjustments [semaphore index in array ] += sem_op
692  sop--
695  Return result
Caller
NameDescribe
perform_atomic_semop