Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\printk\printk_safe.c Create Date:2022-07-28 10:07:38
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Add a message to per-CPU context-dependent buffer

Proto:static __printf(2, 0) int printk_safe_log_store(struct printk_safe_seq_buf *s, const char *fmt, va_list args)

Type:int

Parameter:

TypeParameterName
struct printk_safe_seq_buf *s
const char *fmt
va_listargs
75  again :
76  len = atomic_read( & length of written data )
79  If len >= size of buffer - 1 Then
80  atomic_inc( & message_lost)
81  Get flushed in a more safe context.
82  Return 0
89  If Not len Then smp_rmb()
92  va_copy(ap, args)
93  add = vscnprintf - Format a string and place it in a buffer*@buf: The buffer to place the result into*@size: The size of the buffer, including the trailing null space*@fmt: The format string to use*@args: Arguments for the format string* The return value is the
94  va_end(ap)
95  If Not add Then Return 0
103  If atomic_cmpxchg( & length of written data , len, len + add) != len Then Go to again
106  Get flushed in a more safe context.
107  Return add
Caller
NameDescribe
vprintk_safeLock-less printk(), to avoid deadlocks should the printk() recurse* into itself. It uses a per-CPU buffer to store the message, just like* NMI.