Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:d_alloc_undo - lookup (and if not present create) undo array*@ns: namespace*@semid: semaphore array id* The function looks up (and if not present creates) the undo structure.* The size of the undo structure depends on the size of the semaphore

Proto:static struct sem_undo *find_alloc_undo(struct ipc_namespace *ns, int semid)

Type:struct sem_undo

Parameter:

TypeParameterName
struct ipc_namespace *ns
intsemid
1895  error = If the task doesn't already have a undo_list, then allocate one* here. We guarantee there is only one thread using this undo list,* and current is THE ONE* If this allocation and assignment succeeds, but later
1896  If error Then Return ERR_PTR(error)
1899  _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
1900  spin_lock( & lock)
1901  un = lookup_undo(ulp, semid)
1902  spin_unlock( & lock)
1903  If Value is more likely to compile time(un != NULL) Then Go to out
1908  sma = sem_obtain_object_check(ns, semid)
1909  If IS_ERR(sma) Then
1910  _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()
1911  Return ERR_CAST - Explicitly cast an error-valued pointer to another pointer type*@ptr: The pointer to cast.* Explicitly cast an error-valued pointer to another pointer type in such a* way as to make it clear that's what's going on.
1914  nsems = . of semaphores in array
1915  If Not ipc_rcu_getref( & permissions .. see ipc.h ) Then
1916  _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()
1917  un = ERR_PTR( - EIDRM)
1918  Go to out
1920  _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()
1923  new = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
1924  If Not new Then
1925  ipc_rcu_putref( & permissions .. see ipc.h , sem_rcu_free)
1926  Return ERR_PTR( - ENOMEM)
1930  _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
1931  sem_lock_and_putref(sma)
1932  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
1933  sem_unlock(sma, - 1)
1934  _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()
1935  kfree(new)
1936  un = ERR_PTR( - EIDRM)
1937  Go to out
1939  spin_lock( & lock)
1944  un = lookup_undo(ulp, semid)
1945  If un Then
1946  kfree(new)
1947  Go to success
1950  array of adjustments = (short * ) & new[1]
1951  ack ptr to sem_undo_list = ulp
1952  semaphore set identifier = semid
1953  assert_spin_locked( & lock)
1954  list_add_rcu - add a new entry to rcu-protected list*@new: new entry to be added*@head: list head to add it after* Insert a new entry after the specified head
1955  ipc_assert_locked_object( & permissions .. see ipc.h )
1956  list_add - add a new entry*@new: new entry to be added*@head: list head to add it after* Insert a new entry after the specified head.* This is good for implementing stacks.
1957  un = new
1959  success :
1960  spin_unlock( & lock)
1961  sem_unlock(sma, - 1)
1962  out :
1963  Return un
Caller
NameDescribe
do_semtimedop