函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:ipc\sem.c Create Date:2022-07-27 18:18:49
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称: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)

函数原型:static int newary(struct ipc_namespace *ns, struct ipc_params *params)

返回类型:int

参数:

类型参数名称
struct ipc_namespace *ns
struct ipc_params *params
513  key等于key
514  nsems等于 for semaphores
515  semflg等于flg
518  如果非nsems则返回:负EINVAL
520  如果used_semsnsems大于sc_semmns则返回:负ENOSPC
523  sma等于sem_alloc(nsems)
524  如果非sma则返回:负ENOMEM
527  mode等于semflg按位与S_IRWXUGO
528  key等于key
530  security = NULL
531  retval等于security_sem_alloc( & permissions .. see ipc.h )
532  如果retval
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  返回:retval
537 i小于nsems循环
538  初始化链表头
539  初始化链表头
540  spin_lock_init( & 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  初始化链表头
546  初始化链表头
547  初始化链表头
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  如果retval小于0则
554  ipc_rcu_putref( & permissions .. see ipc.h , sem_rcu_free)
555  返回: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  返回:id