Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:do_syslog

Proto:int do_syslog(int type, char __user *buf, int len, int source)

Type:int

Parameter:

TypeParameterName
inttype
char __user *buf
intlen
intsource
1505  bool clear = false
1506  saved_console_loglevel = default (or last) loglevel
1509  error = check_syslog_permissions(type, source)
1510  If error Then Return error
1514  Case type == Close the log. Currently a NOP.
1515  Break
1516  Case type == Open the log. Currently a NOP.
1517  Break
1518  Case type == Read from the log.
1519  If Not buf || len < 0 Then Return -EINVAL
1521  If Not len Then Return 0
1523  If Not access_ok - Checks if a user space pointer is valid*@addr: User space pointer to start of block to check*@size: Size of block to check* Context: User context only. This function may sleep if pagefaults are* enabled.(buf, len) Then Return -EFAULT
1525  error = 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, he next printk record to read by syslog(READ) or /proc/kmsg != dex and sequence number of the next record to store in the buffer )
1527  If error Then Return error
1529  error = syslog_print(buf, len)
1530  Break
1532  Case type == Read and clear all messages remaining in the ring buffer
1533  clear = true
1536  Case type == Read all messages remaining in the ring buffer.
1537  If Not buf || len < 0 Then Return -EINVAL
1539  If Not len Then Return 0
1541  If Not access_ok - Checks if a user space pointer is valid*@addr: User space pointer to start of block to check*@size: Size of block to check* Context: User context only. This function may sleep if pagefaults are* enabled.(buf, len) Then Return -EFAULT
1543  error = syslog_print_all(buf, len, clear)
1544  Break
1546  Case type == Clear ring buffer.
1547  syslog_clear()
1548  Break
1550  Case type == Disable printk's to console
1551  If saved_console_loglevel == default (or last) loglevel Then saved_console_loglevel = console_loglevel
1553  console_loglevel = minimum_console_loglevel
1554  Break
1556  Case type == Enable printk's to console
1561  Break
1563  Case type == Set level of messages printed to console
1564  If len < 1 || len > 8 Then Return -EINVAL
1566  If len < minimum_console_loglevel Then len = minimum_console_loglevel
1568  console_loglevel = len
1570  saved_console_loglevel = default (or last) loglevel
1571  Break
1573  Case type == Return number of unread characters in the log buffer
1574  Helper macros to lock/unlock logbuf_lock and switch between* printk-safe/unsafe modes.()
1579  syslog_partial = 0
1581  If source == SYSLOG_FROM_PROC Then
1588  Else
1590  idx = syslog_idx
1591  time = If syslog_partial Then syslog_time Else printk_time
1602  error -= syslog_partial
1604  logbuf_unlock_irq()
1605  Break
1607  Case type == Return size of the log buffer
1608  error = log_buf_len
1609  Break
1610  Default
1611  error = -EINVAL
1612  Break
1615  Return error
Caller
NameDescribe
SYSCALL_DEFINE3