Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Free a semaphore set. freeary() is called with sem_ids.rwsem locked* as a writer and the spinlock for this semaphore set hold. sem_ids.rwsem* remains locked on exit.

Proto:static void freeary(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp)

Type:void

Parameter:

TypeParameterName
struct ipc_namespace *ns
struct kern_ipc_perm *ipcp
1128  sma = container_of - cast a member of a structure out to the containing structure*@ptr: the pointer to the member.*@type: the type of the container struct this is embedded in.*@member: the name of the member within the struct.(ipcp, structsem_array, sem_perm)
1133  ipc_assert_locked_object( & permissions .. see ipc.h )
1135  deletes entry from list
1136  spin_lock( & lock)
1137  semaphore set identifier = -1
1138  list_del_rcu - deletes entry from list without re-initialization*@entry: the element to delete from the list
1139  spin_unlock( & lock)
1140  kfree_rcu() - kfree an object after a grace period(un, rcu)
1145  unlink_queue(sma, q)
1146  wake_up_sem_queue_prepare(q, - EIDRM, & wake_q)
1150  unlink_queue(sma, q)
1151  wake_up_sem_queue_prepare(q, - EIDRM, & wake_q)
1153  When i < . of semaphores in array cycle
1154  sem = sems[i]
1156  unlink_queue(sma, q)
1157  wake_up_sem_queue_prepare(q, - EIDRM, & wake_q)
1160  unlink_queue(sma, q)
1161  wake_up_sem_queue_prepare(q, - EIDRM, & wake_q)
1163  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)., NULL)
1167  sem_rmid(ns, sma)
1168  sem_unlock(sma, - 1)
1169  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
1171  wake_up_q( & wake_q)
1172  used_sems -= . of semaphores in array
1173  ipc_rcu_putref( & permissions .. see ipc.h , sem_rcu_free)
Caller
NameDescribe
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.