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

📄 klogd.8

📁 制作2.6内核的CLFS时 sysklogd-1.5.tar.gz包
💻 8
📖 第 1 页 / 共 2 页
字号:
The difficulty with diagnosing errors in loadable modules is due tothe dynamic nature of the kernel modules.  When a module is loaded thekernel will allocate memory to hold the module, when the module isunloaded this memory will be returned back to the kernel.  Thisdynamic memory allocation makes it impossible to produce a map filewhich details the addresses of the variable and functions in a kernelloadable module.  Without this location map it is not possible for akernel developer to determine what went wrong if a protection faultinvolves a kernel module..B klogdhas support for dealing with the problem of diagnosing protectionfaults in kernel loadable modules.  At program start time or inresponse to a signal the daemon will interrogate the kernel for alisting of all modules loaded and the addresses in memory they areloaded at.  Individual modules can also register the locations ofimportant functions when the module is loaded.  The addresses of theseexported symbols are also determined during this interrogationprocess.When a protection fault occurs an attempt will be made to resolvekernel addresses from the static symbol table.  If this fails thesymbols from the currently loaded modules are examined in an attemptto resolve the addresses.  At the very minimum this allows klogd toindicate which loadable module was responsible for generating theprotection fault.  Additional information may be available if themodule developer chose to export symbol information from the module.Proper and accurate resolution of addresses in kernel modules requiresthat.B klogdbe informed whenever the kernel module status changes.  The.B \-iand.B \-Iswitches can be used to signal the currently executing daemon thatsymbol information be reloaded.  Of most importance to properresolution of module symbols is the.B \-iswitch.  Each time a kernel module is loaded or removed from thekernel the following command should be executed:.nf.I klogd \-i.fiThe.B \-pswitch can also be used to insure that module symbol information is upto date.  This switch instructs.B klogdto reload the module symbol information whenever a protection faultis detected.  Caution should be used before invoking the program in\&'paranoid\&' mode.  The stability of the kernel and the operatingenvironment is always under question when a protection fault occurs.Since the klogd daemon must execute system calls in order to read themodule symbol information there is the possibility that the system maybe too unstable to capture useful information.  A much better policyis to insure that klogd is updated whenever a module is loaded orunloaded.  Having uptodate symbol information loaded increases theprobability of properly resolving a protection fault if it should occur.Included in the sysklogd source distribution is a patch to themodules-2.0.0 package which allows the.B insmod,.B rmmodand.B modprobeutilities to automatically signal.B klogdwhenever a module is inserted or removed from the kernel.  Using thispatch will insure that the symbol information maintained in klogd isalways consistent with the current kernel state..SH CONSOLE LOG LEVELThe.B klogddaemon allows the ability to alter the presentation ofkernel messages to the system console.  Consequent with theprioritization of kernel messages was the inclusion of defaultmessaging levels for the kernel.  In a stock kernel the the defaultconsole log level is set to 7.  Any messages with a priority levelnumerically lower than 7 (higher priority) appear on the console.Messages of priority level 7 are considered to be 'debug' messages andwill thus not appear on the console.  Many administrators,particularly in a multi\-user environment, prefer that all kernelmessages be handled by klogd and either directed to a file or tothe syslogd daemon.  This prevents 'nuisance' messages such as lineprinter out of paper or disk change detected from cluttering theconsole.When.B \-cis given on the commandline the.B klogddaemon will execute a system call to inhibit all kernel messages frombeing displayed on the console.  Former versions always issued thissystem call and defaulted to all kernel messages except for panics.This is handled differently currently so.B klogddoesn't need to set this value anymore.  Theargument given to the \fB\-c\fR switch specifies the priority level ofmessages which will be directed to the console.  Note that messages ofa priority value LOWER than the indicated number will be directed tothe console..IPFor example, to have the kernel display all messages with apriority level of 3.BR "" ( KERN_ERR )or more severe the followingcommand would be executed:.IP.nf	klogd \-c 4.fi.PPThe definitions of the numeric values for kernel messages are given inthe file .IR kernel.h " which can be found in the " /usr/include/linuxdirectory if the kernel sources are installed.  These values parallelthe syslog priority values which are defined in the file .IR syslog.h " found in the " /usr/include/sys " sub\-directory."The console log level is usually configured with the.BR sysctl (8)program, directly or via its configuration file.IR /etc/sysctl.conf .In this file the following line .IP.nfkernel.printk = 4 4 1 7.fi.PPcorresponds to the sampe setting above..SH SIGNAL HANDLINGThe .B klogdwill respond to eight signals:.BR SIGHUP ", " SIGINT ", " SIGKILL ", " SIGTERM ", " SIGTSTP ", ".BR SIGUSR1 ", "SIGUSR2 " and " SIGCONT ".  The".BR SIGINT ", " SIGKILL ", " SIGTERM " and " SIGHUPsignals will cause the daemon to close its kernel log sources andterminate gracefully.The .BR SIGTSTP " and " SIGCONTsignals are used to start and stop kernel logging.  Upon receipt of a .B SIGTSTPsignal the daemon will close itslog sources and spin in an idle loop.  Subsequent receipt of a .B SIGCONTsignal will cause the daemon to go through its initialization sequenceand re-choose an input source.  Using.BR SIGSTOP " and " SIGCONTin combination the kernel log input can be re-chosen without stopping andrestarting the daemon.  For example if the \fI/proc\fR file system is to beun-mounted the following command sequence should be used:.PP.PD 0.TP	# kill -TSTP pid.TP	# umount /proc.TP	# kill -CONT pid.PD.PPNotations will be made in the system logs with .B LOG_INFOprioritydocumenting the start/stop of logging.The .BR SIGUSR1 " and " SIGUSR2signals are used to initiate loading/reloading of kernel symbol information.Receipt of the.B SIGUSR1signal will cause the kernel module symbols to be reloaded.  Signaling thedaemon with.B SIGUSR2will cause both the static kernel symbols and the kernel module symbols tobe reloaded.Provided that the System.map file is placed in an appropriate location thesignal of generally greatest usefulness is the.B SIGUSR1signal.  This signal is designed to be used to signal the daemon when kernelmodules are loaded/unloaded.  Sending this signal to the daemon after akernel module state change will insure that proper resolution of symbols willoccur if a protection fault occurs in the address space occupied by a kernelmodule..SH FILES.PD 0.TP.I /proc/kmsgOne Source for kernel messages.B klogd.TP.I /var/run/klogd.pidThe file containing the process id of .B klogd.TP.I /boot/System.map, /System.map, /usr/src/linux/System.mapDefault locations for kernel system maps..PD.SH BUGSProbably numerous.  Well formed context diffs appreciated..SH AUTHORSThe kernel log daemon.B klogdwas originally written by Steve Lord <lord@cray.com>, Greg Wettsteinmade major improvements.  Martin Schulze <joey@infodrom.org> fixedsome bugs and took over maintenance.

⌨️ 快捷键说明

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