是蟲啦,不是警告。在 Linux kernel 的 mailing list 看到一則有意思的張貼,全文如下,Jollen 把重點用紅色標示出來:
* Jeremy Fitzhardingewrote: > 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",並不是字面上所表示的「警告」訊息!
Jollen's Blog 使用 Github issues 與讀者交流討論。請點擊上方的文章專屬 issue,或 open a new issue
您可透過電子郵件 jollen@jollen.org,或是 Linkedin 與我連絡。更歡迎使用微信,請搜尋 WeChat ID:jollentw