函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:do_msgsnd

函数原型:static long do_msgsnd(int msqid, long mtype, void __user *mtext, size_t msgsz, int msgflg)

返回类型:long

参数:

类型参数名称
intmsqid
longmtype
void __user *mtext
size_tmsgsz
intmsgflg
826  ns等于ipc_ns
828  如果msgsz大于msg_ctlmaxmsgsz小于0或msqid小于0则返回:负EINVAL
830  如果mtype小于1则返回:负EINVAL
833  msg等于load_msg(mtext, msgsz)
834  如果是错误则返回:错误
837  m_type等于mtype
838  message text size 等于msgsz
840  _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
841  msq等于msq_obtain_object_check(ns, msqid)
842  如果是错误
843  err等于错误
844  转到:out_unlock1
847  ipc_lock_object( & q_perm)
849  循环
852  err等于负EACCES
853  如果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_则转到:out_unlock0
858  err等于负EIDRM
859  转到:out_unlock0
862  err等于security_msg_queue_msgsnd( & q_perm, msg, msgflg)
863  如果err则转到:out_unlock0
866  如果msg_fits_inqueue(msq, msgsz)则退出
870  如果msgflg按位与urn error on wait
871  err等于负EAGAIN
872  转到:out_unlock0
876  ss_add(msq, & s, msgsz)
878  如果非ipc_rcu_getref( & q_perm)则
879  err等于负EIDRM
880  转到:out_unlock0
883  ipc_unlock_object( & q_perm)
884  _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()
885  进程调度
887  _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
888  ipc_lock_object( & q_perm)
890  ipc_rcu_putref( & q_perm, msg_rcu_free)
893  err等于负EIDRM
894  转到:out_unlock0
896  ss_del( & s)
898  如果signal_pending(当前进程)则
900  转到:out_unlock0
905  ipc_update_pid( & pid of last msgsnd , task_tgid(当前进程))
906  last msgsnd 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.
908  如果非pipelined_send(msq, msg, & wake_q)则
910  添加链表项
911  current number of bytes on queue 加等于msgsz
912  umber of messages in queue 自加
913  atomic_add(msgsz, & msg_bytes)
914  atomic_inc( & msg_hdrs)
917  err等于0
918  msg = NULL
920  out_unlock0 :
921  ipc_unlock_object( & q_perm)
922  wake_up_q( & wake_q)
923  out_unlock1 :
924  _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()
925  如果(msg != NULL)则free_msg(msg)
927  返回:err
调用者
名称描述
ksys_msgsnd
compat_ksys_msgsnd