티스토리 뷰
dmesg는 커널에서 출력되는 메시지를 일정 수준 기록하는 버퍼입니다. 오늘은 이놈에 대해 조금 공부해봅시다, 특별한 기능 없어도, 아는것이 힘이니까. man page를 보면 아래와 같이 상당히 간략합니다.
NAME
dmesg - print or control the kernel ring buffer
SYNOPSIS
dmesg [ -c ] [ -n level ] [ -s bufsize ]
DESCRIPTION
dmesg is used to examine or control the kernel ring buffer.
The program helps users to print out their bootup messages. Instead of copying the messages by hand, the user
need only:
dmesg > boot.messages
and mail the boot.messages file to whoever can debug their problem.
OPTIONS
-c Clear the ring buffer contents after printing.
-sbufsize
Use a buffer of size bufsize to query the kernel ring buffer. This is 16392 by default. (The default
kernel syslog buffer size was 4096 at first, 8192 since 1.3.54, 16384 since 2.1.113.) If you have set
the kernel buffer to be larger than the default then this option can be used to view the entire buffer.
-nlevel
Set the level at which logging of messages is done to the console. For example, -n 1 prevents all messages, expect panic messages, from appearing on the console. All levels of messages are still written
to /proc/kmsg, so syslogd(8) can still be used to control exactly where kernel messages appear. When the -n option is used, dmesg will not print or clear the kernel ring buffer.
When both options are used, only the last option on the command line will have an effect.
SEE ALSO
syslogd(8)
DMESG(8)
기본적으로 버퍼를 clear하는 옵션과, 버퍼 사이즈를 재조정하는 옵션이 눈에 띄고, [ -n level ] 이라는 옵션이 눈에 들어옵니다. 이 옵션은 kernel msg의 Level을 지정하는 옵션인데 0~7까지 지정이 가능하며, 각 숫자의 의미는 아래와 같이 커널 코드에 명시되어 있습니다.
#define KERN_EMERG "<0>" /* system is unusable */
#define KERN_ALERT "<1>" /* action must be taken immediately */
#define KERN_CRIT "<2>" /* critical conditions */
#define KERN_ERR "<3>" /* error conditions */
#define KERN_WARNING "<4>" /* warning conditions */
#define KERN_NOTICE "<5>" /* normal but significant condition */
#define KERN_INFO "<6>" /* informational */
#define KERN_DEBUG "<7>" /* debug-level messages */
자, 이제 불필요한 커널 디버깅이 필요없다면, (쓸때없이 찍히는 printk가 싫다면) [dmesg -n 1] 정도 옵션을 주고 리눅스를 사용하도록 합시다 :)
'개발 > Linux' 카테고리의 다른 글
pages_to_mb (0) | 2011.11.02 |
---|---|
for_each_possible_cpu (0) | 2011.11.01 |
vmalloc 영역... [가설] (0) | 2011.10.28 |
RPC Packet header에 대한 짧은 참고의 글.. (0) | 2011.10.13 |
sleep_on(), wake_up() (0) | 2011.10.10 |
댓글
최근에 올라온 글
최근에 달린 댓글
글 보관함
- Total
- Today
- Yesterday