Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:ipc\shm.c Create Date:2022-07-28 16:47:33
Last Modify:2020-03-17 22:58:32 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:This function handles some shmctl commands which require the rwsem* to be held in write mode.* NOTE: no locks must be held, the rwsem is taken inside this function.

Proto:static int shmctl_down(struct ipc_namespace *ns, int shmid, int cmd, struct shmid64_ds *shmid64)

Type:int

Parameter:

TypeParameterName
struct ipc_namespace *ns
intshmid
intcmd
struct shmid64_ds *shmid64
898  lock for writing
899  _read_lock() - mark the beginning of an RCU read-side critical section* When synchronize_rcu() is invoked on one CPU while other CPUs* are within RCU read-side critical sections, then the* synchronize_rcu() is guaranteed to block until after all the other
901  ipcp = pcctl_obtain_check - retrieve an ipc object and check permissions*@ns: ipc namespace*@ids: the table of ids where to look for the ipc*@id: the id of the ipc to retrieve*@cmd: the cmd to check*@perm: the permission to set*@extra_perm: one extra permission
903  If IS_ERR(ipcp) Then
904  err = PTR_ERR(ipcp)
905  Go to out_unlock1
908  shp = 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, structshmid_kernel, shm_perm)
910  err = security_shm_shmctl( & shm_perm, cmd)
911  If err Then Go to out_unlock1
915  Case cmd == move resource
916  ipc_lock_object( & shm_perm)
918  Called with shm_ids.rwsem (writer) and the shp structure locked.* Only shm_ids.rwsem remains locked on exit.
919  Go to out_up
920  Case cmd == set ipc_perm options
921  ipc_lock_object( & shm_perm)
922  err = pc_update_perm - update the permissions of an ipc object*@in: the permission given as input.*@out: the permission of the ipc to set.
923  If err Then Go to out_unlock0
925  shm_ctim = ktime_get_real_seconds - Get the seconds portion of CLOCK_REALTIME* Returns the wall clock seconds since 1970. This replaces the* get_seconds() interface which is not y2038 safe on 32bit systems.
926  Break
927  Default
928  err = -EINVAL
929  Go to out_unlock1
932  out_unlock0 :
933  ipc_unlock_object( & shm_perm)
934  out_unlock1 :
935  _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()
936  out_up :
937  lease a write lock
938  Return err
Caller
NameDescribe
ksys_shmctl
compat_ksys_shmctl