Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:syslog_print

Proto:static int syslog_print(char __user *buf, int size)

Type:int

Parameter:

TypeParameterName
char __user *buf
intsize
1354  len = 0
1356  text = Allocation memory
1357  If Not text Then Return -ENOMEM
1360  When size > 0 cycle
1364  Helper macros to lock/unlock logbuf_lock and switch between* printk-safe/unsafe modes.()
1369  syslog_partial = 0
1373  Break
1380  If Not syslog_partial Then syslog_time = printk_time
1383  skip = syslog_partial
1384  msg = get record by index; idx must point to valid msg
1385  n = msg_print_text(msg, true, syslog_time, text, LOG_LINE_MAX + PREFIX_MAX)
1387  If n - syslog_partial <= size Then
1391  n -= syslog_partial
1392  syslog_partial = 0
1393  Else if Not len Then
1395  n = size
1396  syslog_partial += n
1397  Else n = 0
1399  logbuf_unlock_irq()
1401  If Not n Then Break
1404  If copy_to_user(buf, text + skip, n) Then
1405  If Not len Then len = -EFAULT
1407  Break
1410  len += n
1411  size -= n
1412  buf += n
1415  kfree - free previously allocated memory*@objp: pointer returned by kmalloc.* If @objp is NULL, no operation is performed.* Don't free memory not originally allocated by kmalloc()* or you will run into trouble.
1416  Return len
Caller
NameDescribe
do_syslog