diff --git a/Software/System/Linux/Modules/KernelDriver/API/printk_说明.md b/Software/System/Linux/Modules/KernelDriver/API/printk_说明.md new file mode 100644 index 0000000..2f8416f --- /dev/null +++ b/Software/System/Linux/Modules/KernelDriver/API/printk_说明.md @@ -0,0 +1,28 @@ +# printk 说明 + +## 头文件 + +```cpp +#include +``` + +## 函数原型 + +```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 +```