增加 printk 说明.

Signed-off-by: ithink.chan <chenyang@autoai.com>
This commit is contained in:
ithink.chan 2019-10-21 09:37:04 +08:00
parent 7541ada7e0
commit ddf4c1eb3b
1 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,28 @@
# printk 说明
## 头文件
```cpp
#include <linux/kernel.h>
```
## 函数原型
```cpp
int printk(const char *fmt, ...);
```
## 参数说明
在 fmt 字符串前面增加以下宏可以控制 printk 的输出级别,数值越小打印级别越高。当设置的级别地于当前打印级别时,打印信息将不被输出。
```cpp
#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
```