函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:ipc\msg.c Create Date:2022-07-27 18:16:50
Last Modify:2020-03-17 22:56:56 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:This function handles some msgctl commands which require the rwsem* to be held in write mode.* NOTE: no locks must be held, the rwsem is taken inside this function.

函数原型:static int msgctl_down(struct ipc_namespace *ns, int msqid, int cmd, struct ipc64_perm *perm, int msg_qbytes)

返回类型:int

参数:

类型参数名称
struct ipc_namespace *ns
intmsqid
intcmd
struct ipc64_perm *perm
intmsg_qbytes
386  lock for writing
387  _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
389  ipcp等于pcctl_obtain_check - retrieve an ipc object and check permissions*@ns: ipc namespace*@ids: the table of ids where to look for the ipc*@id: the id of the ipc to retrieve*@cmd: the cmd to check*@perm: the permission to set*@extra_perm: one extra permission
391  如果是错误
392  err等于错误
393  转到:out_unlock1
396  msq等于container_of - cast a member of a structure out to the containing structure*@ptr: the pointer to the member.*@type: the type of the container struct this is embedded in.*@member: the name of the member within the struct.(ipcp, structmsg_queue, q_perm)
398  err等于security_msg_queue_msgctl( & q_perm, cmd)
399  如果err则转到:out_unlock1
403  :cmd恒等于move resource
404  ipc_lock_object( & q_perm)
406  que() wakes up waiters on the sender and receiver waiting queue,* removes the message queue from message queue ID IDR, and cleans up all the* messages associated with this queue.* msg_ids.rwsem (writer) and the spinlock for this message queue are held
407  转到:out_up
408  :cmd恒等于set ipc_perm options
412  如果msg_qbytes大于msg_ctlmnb且非操作权限检查
414  err等于负EPERM
415  转到:out_unlock1
418  ipc_lock_object( & q_perm)
419  err等于pc_update_perm - update the permissions of an ipc object*@in: the permission given as input.*@out: the permission of the ipc to set.
420  如果err则转到:out_unlock0
423  max number of bytes on queue 等于msg_qbytes
425  last change 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.
430  expunge_all(msq, - EAGAIN, & wake_q)
435  ss_wakeup(msq, & wake_q, false)
436  ipc_unlock_object( & q_perm)
437  wake_up_q( & wake_q)
439  转到:out_unlock1
441  默认
442  err等于负EINVAL
443  转到:out_unlock1
446  out_unlock0 :
447  ipc_unlock_object( & q_perm)
448  out_unlock1 :
449  _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()
450  out_up :
451  lease a write lock
452  返回:err
调用者
名称描述
ksys_msgctl
compat_ksys_msgctl