Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:shmctl_stat

Proto:static int shmctl_stat(struct ipc_namespace *ns, int shmid, int cmd, struct shmid64_ds *tbuf)

Type:int

Parameter:

TypeParameterName
struct ipc_namespace *ns
intshmid
intcmd
struct shmid64_ds *tbuf
986  memset(tbuf, 0, size of tbuf )
988  _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
989  If cmd == pcs ctl commands || cmd == SHM_STAT_ANY Then
990  shp = shm_obtain_object(ns, shmid)
991  If IS_ERR(shp) Then
992  err = PTR_ERR(shp)
993  Go to out_unlock
995  Else
996  shp = shm_obtain_object_check(ns, shmid)
997  If IS_ERR(shp) Then
998  err = PTR_ERR(shp)
999  Go to out_unlock
1010  If cmd == SHM_STAT_ANY Then audit_ipc_obj( & shm_perm)
1012  Else
1013  err = -EACCES
1014  If pcperms - check ipc permissions*@ns: ipc namespace*@ipcp: ipc permission set*@flag: desired permission set* Check user, group, other permissions for access* to ipc resources. return 0 if allowed*@flag will most probably be 0 or ``S_ Then Go to out_unlock
1018  err = security_shm_shmctl( & shm_perm, cmd)
1019  If err Then Go to out_unlock
1022  ipc_lock_object( & shm_perm)
1024  If Not pc_valid_object() - helper to sort out IPC_RMID races for codepaths* where the respective ipc_ids.rwsem is not being held down.* Checks whether the ipc object is still around or if it's gone already, as Then
1025  ipc_unlock_object( & shm_perm)
1026  err = -EIDRM
1027  Go to out_unlock
1030  kernel_to_ipc64_perm - convert kernel ipc permissions to user*@in: kernel permissions*@out: new style ipc permissions* Turn the kernel object @in into a set of permissions descriptions* for returning to userspace (@out).
1031  size of segment (bytes) = shm_segsz
1032  last attach time = shm_atim
1033  last detach time = shm_dtim
1034  last change time = shm_ctim
1036  shm_atime_high = shm_atim >> 32
1037  shm_dtime_high = shm_dtim >> 32
1038  shm_ctime_high = shm_ctim >> 32
1040  pid of creator = pid_vnr(shm_cprid)
1041  pid of last operator = pid_vnr(shm_lprid)
1042  . of current attaches = shm_nattch
1044  If cmd == get ipc_perm options Then
1049  err = 0
1050  Else
1055  err = id
1058  ipc_unlock_object( & shm_perm)
1059  out_unlock :
1060  _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()
1061  Return err
Caller
NameDescribe
ksys_shmctl
compat_ksys_shmctl