⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 klogd.8

📁 制作2.6内核的CLFS时 sysklogd-1.5.tar.gz包
💻 8
📖 第 1 页 / 共 2 页
字号:
.\" Copyright 1994-6 Dr. Greg Wettstein, Enjellic Systems Development..\" Copyright 1997-2007 Martin Schulze <joey@infodrom.org>.\" May be distributed under the GNU General Public License.\".TH KLOGD 8 "27 May 2007" "Version 1.5" "Linux System Administration".SH NAMEklogd \- Kernel Log Daemon.SH SYNOPSIS.B klogd.RB [ " \-c ".I n].RB [ " \-d " ].RB [ " \-f ".I fname].RB [ " \-iI " ].RB [ " \-n " ].RB [ " \-o " ].RB [ " \-p " ].RB [ " \-s " ].RB [ " \-k ".I fname].RB [ " \-v " ].RB [ " \-x " ].RB [ " \-2 " ].SH DESCRIPTION.B klogdis a system daemon which intercepts and logs Linux kernelmessages..SH OPTIONS.TP.BI "\-c " nSets the default log level of console messages to \fIn\fR..TP.B "\-d"Enable debugging mode.  This will generate \fBLOTS\fR of output tostderr..TP.BI "\-f " fileLog messages to the specified filename rather than to the syslog facility..TP.BI "\-i \-I"Signal the currently executing klogd daemon.  Both of these switches controlthe loading/reloading of symbol information.  The \-i switch signals thedaemon to reload the kernel module symbols.  The \-I switch signals for areload of both the static kernel symbols and the kernel module symbols..TP.B "\-n"Avoid auto-backgrounding.  This is needed especially if the.B klogdis started and controlled by .BR init (8)..TP.B "\-o"Execute in 'one\-shot' mode.  This causes \fBklogd\fP to read and logall the messages that are found in the kernel message buffers.  Aftera single read and log cycle the daemon exits..TP.B "\-p"Enable paranoia.  This option controls when klogd loads kernel module symbolinformation.  Setting this switch causes klogd to load the kernel modulesymbol information whenever an Oops string is detected in the kernel messagestream..TP.B "\-s"Force \fBklogd\fP to use the system call interface to the kernel messagebuffers..TP.BI "\-k " fileUse the specified file as the source of kernel symbol information..TP.B "\-v"Print version and exit..TP.B "\-x"Omits EIP translation and therefore doesn't read the System.map file..TP.B "\-2"When symbols are expanded, print the line twice.  Once with addressesconverted to symbols, once with the raw text.  This allows externalprograms such as ksymoops do their own processing on the originaldata..SH OVERVIEWThe functionality of klogd has been typically incorporated into otherversions of syslogd but this seems to be a poor place for it.  In themodern Linux kernel a number of kernel messaging issues such assourcing, prioritization and resolution of kernel addresses must beaddressed.  Incorporating kernel logging into a separate processoffers a cleaner separation of services.In Linux there are two potential sources of kernel log information: the .I /procfile system and the syscall (sys_syslog) interface, althoughultimately they are one and the same.  Klogd is designed to choosewhichever source of information is the most appropriate.  It does thisby first checking for the presence of a mounted .I /procfile system.  If this is found the .I /proc/kmsgfile is used as the source of kernel loginformation.  If the proc file system is not mounted .B klogduses asystem call to obtain kernel messages.  The command line switch.RB ( "\-s" )can be used to force klogd to use the system call interface as itsmessaging source.If kernel messages are directed through the .BR syslogd " daemon the " klogddaemon, as of version 1.1, has the ability to properly prioritizekernel messages.  Prioritization of the kernel messages was added to itat approximately version 0.99pl13 of the kernel.  The raw kernel messagesare of the form:.IP\<[0\-7]\>Something said by the kernel..PPThe priority of the kernel message is encoded as a single numericdigit enclosed inside the <> pair.  The definitions of these values isgiven in the kernel include file kernel.h.  When a message is receivedfrom the kernel the klogd daemon reads this priority level and assignsthe appropriate priority level to the syslog message.  If file output(\fB-f\fR) is used the prioritization sequence is left pre\-pended to thekernel message.The klogd daemon can also be used in a 'one\-shot' mode for reading thekernel message buffers.  One shot mode is selected by specifying the\fB\-o\fR switch on the command line.  Output will be directed to either thesyslogd daemon or to an alternate file specified by the \fB-f\fR switch..IPFor example, to read all the kernel messages after a systemboot and record them in a file called krnl.msg the followingcommand would be given..IP.nf	klogd -o -f ./krnl.msg.fi.SH KERNEL ADDRESS RESOLUTIONIf the kernel detects an internal error condition a general protectionfault will be triggered.  As part of the GPF handling procedure thekernel prints out a status report indicating the state of theprocessor at the time of the fault.  Included in this display are thecontents of the microprocessor's registers, the contents of the kernelstack and a tracing of what functions were being executed at the timeof the fault.This information is.B EXTREMELY IMPORTANTin determining what caused the internal error condition.  Thedifficulty comes when a kernel developer attempts to analyze thisinformation.  The raw numeric information present in the protectionfault printout is of very little use to the developers.  This is dueto the fact that kernels are not identical and the addresses ofvariable locations or functions will not be the same in all kernels.In order to correctly diagnose the cause of failure a kernel developerneeds to know what specific kernel functions or variable locationswere involved in the error.As part of the kernel compilation process a listing is created whichspecified the address locations of important variables and function inthe kernel being compiled.  This listing is saved in a file calledSystem.map in the top of the kernel directory source tree.  Using thislisting a kernel developer can determine exactly what the kernel wasdoing when the error condition occurred.The process of resolving the numeric addresses from the protectionfault printout can be done manually or by using the.B ksymoopsprogram which is included in the kernel sources.As a convenience.B klogdwill attempt to resolve kernel numeric addresses to their symbolicforms if a kernel symbol table is available at execution time.  If yourequire the original address of the symbol, use the.B -2switch to preserve the numeric address.  Asymbol table may be specified by using the \fB\-k\fR switch on thecommand line.  If a symbol file is not explicitly specified thefollowing filenames will be tried:.nf.I /boot/System.map.I /System.map.I /usr/src/linux/System.map.fiVersion information is supplied in the system maps as of kernel1.3.43.  This version information is used to direct an intelligentsearch of the list of symbol tables.  This feature is useful since itprovides support for both production and experimental kernels.For example a production kernel may have its map file stored in/boot/System.map.  If an experimental or test kernel is compiled withthe sources in the 'standard' location of /usr/src/linux the systemmap will be found in /usr/src/linux/System.map.  When klogd startsunder the experimental kernel the map in /boot/System.map will bebypassed in favor of the map in /usr/src/linux/System.map.Modern kernels as of 1.3.43 properly format important kernel addressesso that they will be recognized and translated by klogd.  Earlierkernels require a source code patch be applied to the kernel sources.This patch is supplied with the sysklogd sources.The process of analyzing kernel protections faults works very wellwith a static kernel.  Additional difficulties are encountered whenattempting to diagnose errors which occur in loadable kernel modules.Loadable kernel modules are used to implement kernel functionality ina form which can be loaded or unloaded at will.  The use of loadablemodules is useful from a debugging standpoint and can also be usefulin decreasing the amount of memory required by a kernel.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -