函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:devkmsg_read

函数原型:static ssize_t devkmsg_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)

返回类型:ssize_t

参数:

类型参数名称
struct file *file
char __user *buf
size_tcount
loff_t *ppos
871  user等于 needed for tty driver, and maybe others
876  如果非user则返回:负EBADF
879  ret等于mutex_lock_interruptible( & lock)
880  如果ret则返回:ret
883  Helper macros to lock/unlock logbuf_lock and switch between* printk-safe/unsafe modes.()
884 seq恒等于dex and sequence number of the next record to store in the buffer 循环
885  如果f_flags按位与O_NONBLOCK
886  ret等于负EAGAIN
888  转到:out
891  logbuf_unlock_irq()
892  ret等于wait_event_interruptible - sleep until a condition gets true*@wq_head: the waitqueue to wait on*@condition: a C expression for the event to wait for* The process is put to sleep (TASK_INTERRUPTIBLE) until the(log_wait, seq != dex and sequence number of the next record to store in the buffer )
894  如果ret则转到:out
896  Helper macros to lock/unlock logbuf_lock and switch between* printk-safe/unsafe modes.()
899  如果seq小于dex and sequence number of the first record stored in the buffer
901  idx等于log_first_idx
902  seq等于dex and sequence number of the first record stored in the buffer
903  ret等于负EPIPE
904  logbuf_unlock_irq()
905  转到:out
908  msg等于get record by index; idx must point to valid msg
909  len等于msg_print_ext_header(buf, buf的长度, msg, seq)
911  len加等于msg_print_ext_body(buf + len, buf的长度 - len, ptional key/value pair dictionary attached to the record , length of dictionary buffer , human readable text of the record , length of text buffer )
915  idx等于get next record; idx must point to valid msg
916  seq自加
917  logbuf_unlock_irq()
919  如果len大于count
920  ret等于负EINVAL
921  转到:out
924  如果copy_to_user(buf, buf, len)则
925  ret等于负EFAULT
926  转到:out
928  ret等于len
929  out :
930  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
931  返回:ret