Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:semctl_setval

Proto:static int semctl_setval(struct ipc_namespace *ns, int semid, int semnum, int val)

Type:int

Parameter:

TypeParameterName
struct ipc_namespace *ns
intsemid
intsemnum
intval
1333  If val > <= 32767 semaphore maximum value || val < 0 Then Return -ERANGE
1336  _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
1337  sma = sem_obtain_object_check(ns, semid)
1338  If IS_ERR(sma) Then
1339  _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()
1340  Return PTR_ERR(sma)
1343  If semnum < 0 || semnum >= . of semaphores in array Then
1344  _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()
1345  Return -EINVAL
1349  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
1350  _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()
1351  Return -EACCES
1354  err = security_sem_semctl( & permissions .. see ipc.h , set semval )
1355  If err Then
1356  _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()
1357  Return -EACCES
1360  If the request contains only one semaphore operation, and there are* no complex transactions pending, lock only the semaphore involved
1362  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
1363  sem_unlock(sma, - 1)
1364  _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()
1365  Return -EIDRM
1368  semnum = 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];* }* (semnum, . of semaphores in array )
1369  curr = sems[semnum]
1371  ipc_assert_locked_object( & permissions .. see ipc.h )
1372  list_for_each_entry - iterate over list of given type*@pos: the type * to use as a loop cursor.*@head: the head for your list.*@member: the name of the list_head within the struct.(un, & undo requests on this array , list_id)
1373  array of adjustments [semnum] = 0
1375  current value = val
1376  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)., task_tgid(current process))
1377  create/last semctl() time = 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.
1379  do_smart_update - optimized update_queue*@sma: semaphore array*@sops: operations that were performed*@nsops: number of operations*@otime: force setting otime*@wake_q: lockless wake-queue head* do_smart_update() does the required calls to update_queue and
1380  sem_unlock(sma, - 1)
1381  _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()
1382  wake_up_q( & wake_q)
1383  Return 0
Caller
NameDescribe
ksys_semctl
compat_ksys_semctl