当前位置: 技术问答>linux和unix
echo 的问题 高分求助
来源: 互联网 发布时间:2015-02-17
本文导语: 在中113页 #echo 8 > /proc/sys/kernel/printk 实现的功能是:使所有的内核消息得到显示, 各位高手,#echo 8 > /proc/sys/kernel/printk 的语法结构是甚么,尤其是这个 8 > | 以下为个人猜测, 不...
在中113页
#echo 8 > /proc/sys/kernel/printk
实现的功能是:使所有的内核消息得到显示,
各位高手,#echo 8 > /proc/sys/kernel/printk
的语法结构是甚么,尤其是这个 8 >
#echo 8 > /proc/sys/kernel/printk
实现的功能是:使所有的内核消息得到显示,
各位高手,#echo 8 > /proc/sys/kernel/printk
的语法结构是甚么,尤其是这个 8 >
|
以下为个人猜测, 不敢保证......
/proc/sys/kernel/printk 其实对应的是kernel里的变量console_loglevel, 在kernel source的kernel/printk.c中会使用到此变量, 用于设置sys log消息的去向, 缺省是DEFAULT_CONSOLE_LOGLEVEL(具体自己查查看, 可能不同版本会有区别). 将/proc/sys/kernel/printk的值设置为8表示将message输出到console上, 关于设置printk的值的意义请查看printk.c中的do_syslog()函数便知
/proc/sys/kernel/printk 其实对应的是kernel里的变量console_loglevel, 在kernel source的kernel/printk.c中会使用到此变量, 用于设置sys log消息的去向, 缺省是DEFAULT_CONSOLE_LOGLEVEL(具体自己查查看, 可能不同版本会有区别). 将/proc/sys/kernel/printk的值设置为8表示将message输出到console上, 关于设置printk的值的意义请查看printk.c中的do_syslog()函数便知
|
看看这个说明:
The four values in printk denote
console_loglevel, default_message_loglevel, minimum_console_level and default_console_loglevel
respectively. These values influence printk() behavior when printing or logging error messages, which come from inside the kernel. See syslog(2) for more information on the different log levels.
console_loglevel
Messages with a higher priority than this will be printed to the console.
default_message_level
Messages without an explicit priority will be printed with this priority.
minimum_console_loglevel
Minimum (highest) value to which the console_loglevel can be set.
default_console_loglevel
Default value for console_loglevel.
The four values in printk denote
console_loglevel, default_message_loglevel, minimum_console_level and default_console_loglevel
respectively. These values influence printk() behavior when printing or logging error messages, which come from inside the kernel. See syslog(2) for more information on the different log levels.
console_loglevel
Messages with a higher priority than this will be printed to the console.
default_message_level
Messages without an explicit priority will be printed with this priority.
minimum_console_loglevel
Minimum (highest) value to which the console_loglevel can be set.
default_console_loglevel
Default value for console_loglevel.