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

后端 未结 2 1777
借酒劲吻你
借酒劲吻你 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:56

    To prevent a new line from being started, use KERN_CONT:

    printk(KERN_ALERT "self destruction commences in ");
    printk(KERN_CONT "%d", time_remaining);
    printk(KERN_CONT " minutes\n");
    

提交回复
热议问题