jollen.org

Jollen 的 Blog
Jollen's email: jollen # jollen.org
more:  Jollen's Training

是蟲啦,不是警告。

.作者:jollen/
.日期:October 18, 2006 9:20 PM


是蟲啦,不是警告。在 Linux kernel 的 mailing list 看到一則有意思的張貼,全文如下,Jollen 把重點用紅色標示出來:

* Jeremy Fitzhardinge  wrote:

> A warning is a warning, not a BUG.

> - printk("BUG: warning at %s:%d/%s()n", __FILE__,
> + printk("WARNING at %s:%d %s()n", __FILE__,

i'm not really happy about this change.

Firstly, 
most WARN_ON()s are /bugs/, not warnings ... 
If it's a real
warning, a KERN_INFO printk should be done.

Secondly, the reason i changed it to the 'BUG: ...' format is that i
tried to make it easier for automated tools (and for users) to figure
out that a kernel bug happened.

Ingo
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/ 

很重要,一定要看的概念。在 Linux kernel 裡,WARN_ON() 所秀出來的訊息格式為「BUG: xxx」,表示這是一個臭蟲。如果是警告訊息,則是用 loglevel 'KERN_INFO' 來列印訊息。

所以,這位老兄解釋的很清楚,這類的 "warning" 訊息是 kernel 的 "bug",並不是字面上所表示的「警告」訊息!

Tags:

純手工打造說明:技術專欄文章為 Jollen 原創,內容皆為人工撰寫,無 AI 生成。轉載請註明出處與作者,並全文引用。轉載時請在文章開頭或結尾明顯處註明「本文出處:https://www.jollen.org,已取得原作者同意並授權使用。」
訂閱電子報:不定期 Jollen's Blog 精選文章隨 Moko365 電子報寄送;請透過 Moko365 電子報訂閱(可隨時取消)。

Copyright(c) 2001–2006 www.jollen.org. All rights reserved.
Last update: 2026-07-22