Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:wary - Create a new semaphore set*@ns: namespace*@params: ptr to the structure that contains key, semflg and nsems* Called with sem_ids.rwsem held (as a writer)

Proto:static int newary(struct ipc_namespace *ns, struct ipc_params *params)

Type:int

Parameter:

TypeParameterName
struct ipc_namespace *ns
struct ipc_params *params
513  key = key
514  nsems = for semaphores
515  semflg = flg
518  If Not nsems Then Return -EINVAL
520  If used_sems + nsems > sc_semmns Then Return -ENOSPC
523  sma = sem_alloc(nsems)
524  If Not sma Then Return -ENOMEM
527  mode = semflg & S_IRWXUGO
528  key = key
530  security = NULL
531  retval = security_sem_alloc( & permissions .. see ipc.h )
532  If retval Then
533  kvfree() - Free memory.*@addr: Pointer to allocated memory.* kvfree frees memory allocated by any of vmalloc(), kmalloc() or kvmalloc().* It is slightly more efficient to use kfree() or vfree() if you are certain* that you know which one to use.
534  Return retval
537  When i < nsems cycle
538  Initialization list head
539  Initialization list head
540  Process spin lock initialization( & spinlock for fine-grained semtimedop )
543  pending complex operations = 0
544  >0: global lock required = Switching from the mode suitable for simple ops* to the mode for complex ops is costly. Therefore:* use some hysteresis
545  Initialization list head
546  Initialization list head
547  Initialization list head
548  . of semaphores in array = nsems
549  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.
552  retval = pc_addid - add an ipc identifier*@ids: ipc identifier set*@new: new ipc permission set*@limit: limit for the number of used ids* Add an entry 'new' to the ipc ids idr
553  If retval < 0 Then
554  ipc_rcu_putref( & permissions .. see ipc.h , sem_rcu_free)
555  Return retval
557  used_sems += nsems
559  sem_unlock(sma, - 1)
560  _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()
562  Return id