Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\debug\kdb\kdb_main.c Create Date:2022-07-28 11:41:59
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:kdb_dmesg - This function implements the 'dmesg' command to display* the contents of the syslog buffer.* dmesg [lines] [adjust]

Proto:static int kdb_dmesg(int argc, const char **argv)

Type:int

Parameter:

TypeParameterName
intargc
const char **argv
2096  lines = 0
2097  adjust = 0
2098  n = 0
2099  skip = 0
2100  struct kmsg_dumper dumper = {active = 1}
2104  If argc > 2 Then Return KDB_ARGCOUNT
2106  If argc Then
2108  lines = simple_strtol - convert a string to a signed long*@cp: The start of the string*@endp: A pointer to the end of the parsed string will be placed here*@base: The number base to use* This function is obsolete. Please use kstrtol instead.
2109  If cp Then lines = 0
2111  If argc > 1 Then
2113  If cp || adjust < 0 Then adjust = 0
2119  diag = kdbgetintenv - This function will return the value of an* integer-valued environment variable
2120  If Not diag && logging Then
2121  const char * setargs[] = {"set", "LOGGING", "0"}
2122  kdb_set - This function implements the 'set' command. Alter an* existing environment variable or create a new one.
2125  kmsg_dump_rewind_nolock - reset the interator (unlocked version)*@dumper: registered kmsg dumper* Reset the dumper's iterator so that kmsg_dump_get_line() and* kmsg_dump_get_buffer() can be called again and used multiple* times within the same dumper
2126  When kmsg_dump_get_line_nolock - retrieve one kmsg log line (unlocked version)*@dumper: registered kmsg dumper*@syslog: include the "<4>" prefixes*@line: buffer to copy the line to*@size: maximum size of the buffer*@len: length of line placed into buffer* cycle
2127  n++
2129  If lines < 0 Then
2130  If adjust >= n Then kdb_printf("buffer only contains %d lines, nothing printed\n", n)
2133  Else if adjust - lines >= n Then kdb_printf("buffer only contains %d lines, last %d lines printed\n", n, n - adjust)
2136  skip = adjust
2137  lines = abs - return absolute value of an argument*@x: the value. If it is unsigned type, it is converted to signed type first.* char is treated as if it was signed (regardless of whether it really is)* but the macro's return type is preserved as char.(lines)
2138  Else if lines > 0 Then
2139  skip = n - lines - adjust
2140  lines = abs - return absolute value of an argument*@x: the value. If it is unsigned type, it is converted to signed type first.* char is treated as if it was signed (regardless of whether it really is)* but the macro's return type is preserved as char.(lines)
2141  If adjust >= n Then
2142  kdb_printf("buffer only contains %d lines, nothing printed\n", n)
2144  skip = n
2145  Else if skip < 0 Then
2146  lines += skip
2147  skip = 0
2148  kdb_printf("buffer only contains %d lines, first %d lines printed\n", n, lines)
2151  Else
2152  lines = n
2155  If skip >= n || skip < 0 Then Return 0
2158  kmsg_dump_rewind_nolock - reset the interator (unlocked version)*@dumper: registered kmsg dumper* Reset the dumper's iterator so that kmsg_dump_get_line() and* kmsg_dump_get_buffer() can be called again and used multiple* times within the same dumper
2159  When kmsg_dump_get_line_nolock - retrieve one kmsg log line (unlocked version)*@dumper: registered kmsg dumper*@syslog: include the "<4>" prefixes*@line: buffer to copy the line to*@size: maximum size of the buffer*@len: length of line placed into buffer* cycle
2160  If skip Then
2161  skip--
2162  Continue
2164  If Not lines -- Then Break
2166  If KDB_FLAG(CMD_INTERRUPT) Then Return 0
2169  kdb_printf("%.*s\n", (int)len - 1, buf)
2172  Return 0