How to print a message in one single line in Linux kernel

后端 未结 2 1728
借酒劲吻你
借酒劲吻你 2021-01-04 14:13

I am making a simple enque/deque program in kernel. I want to print message in kernel, and this is what I got:

[18594.595747] Enqueue 3 
[18594.595748]  queu         


        
2条回答
  •  北荒
    北荒 (楼主)
    2021-01-04 14:36

    Debugging by printing

    printk(KERN_ERR "Doing something was ");
    /* <100 lines of whatever>*/
    if (success)
       printk(KERN_CONT "successful\n");
    else
       printk(KERN_CONT "NOT successful\n");
    

    Logging prints should be safe: SFP vs single CPU.

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题