Why printk doesn't print message in kernel log(dmesg)

前端 未结 1 1143
梦毁少年i
梦毁少年i 2020-12-20 17:58

I wrote small kernel module code as mentioned below, I am testing it in ubuntu 14.04

#include  
#include 

        
相关标签:
1条回答
  • 2020-12-20 18:22

    The kernel log ring buffer behaves as if it were line-buffered, as it can be seen in the implementation:

    • in vprintk_emit you can see how it marks a buffer to be flushed/buffered based on the existence of a trailing newline

    • in log_output you can see the actual code which takes care of flushing or buffering the message

    As it is evident, your messages do not contain trailing newlines. Had you deleted the trailing space, you would see the messages in the kernel log after they had been flushed in the printk call(s).

    0 讨论(0)
提交回复
热议问题