Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:semctl_stat

Proto:static int semctl_stat(struct ipc_namespace *ns, int semid, int cmd, struct semid64_ds *semid64)

Type:int

Parameter:

TypeParameterName
struct ipc_namespace *ns
intsemid
intcmd
struct semid64_ds *semid64
1222  memset(semid64, 0, size of semid64 )
1224  _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
1225  If cmd == pcs ctl cmds || cmd == SEM_STAT_ANY Then
1226  sma = sem_lock_(check_) routines are called in the paths where the rwsem* is not held.* The caller holds the RCU read lock.
1227  If IS_ERR(sma) Then
1228  err = PTR_ERR(sma)
1229  Go to out_unlock
1231  Else
1232  sma = sem_obtain_object_check(ns, semid)
1233  If IS_ERR(sma) Then
1234  err = PTR_ERR(sma)
1235  Go to out_unlock
1240  If cmd == SEM_STAT_ANY Then audit_ipc_obj( & permissions .. see ipc.h )
1242  Else
1243  err = -EACCES
1244  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
1248  err = security_sem_semctl( & permissions .. see ipc.h , cmd)
1249  If err Then Go to out_unlock
1252  ipc_lock_object( & permissions .. see ipc.h )
1254  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
1255  ipc_unlock_object( & permissions .. see ipc.h )
1256  err = -EIDRM
1257  Go to out_unlock
1260  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).
1261  semotime = get_semotime(sma)
1262  last semop time = semotime
1263  last change time = create/last semctl() time
1265  sem_otime_high = semotime >> 32
1266  sem_ctime_high = create/last semctl() time >> 32
1268  . of semaphores in array = . of semaphores in array
1270  If cmd == get ipc_perm options Then
1275  err = 0
1276  Else
1281  err = id
1283  ipc_unlock_object( & permissions .. see ipc.h )
1284  out_unlock :
1285  _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()
1286  Return err
Caller
NameDescribe
ksys_semctl
compat_ksys_semctl