Skip to content

Instantly share code, notes, and snippets.

@0x7f454c46
Last active March 5, 2020 19:45
Show Gist options
  • Save 0x7f454c46/c01fc334cd8b8019f7cc2af15bd33077 to your computer and use it in GitHub Desktop.
Save 0x7f454c46/c01fc334cd8b8019f7cc2af15bd33077 to your computer and use it in GitHub Desktop.
pr_cont("\n") tests
[dima@Mindolluin linux-loglevel]$ cat lib/test_pr_cont.c
// SPDX-License-Identifier: GPL-2.0-only
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/printk.h>
static int __init pr_cont_tests(void)
{
pr_info("pr_cont() tests:\n");
pr_info("1 hello");
pr_cont("\n");
pr_cont(" world\n");
pr_info("2 hel");
pr_cont("lo");
pr_cont("\n");
pr_cont(" world\n");
pr_info("3 hello");
pr_cont(" world\n");
pr_info("4 hello");
pr_cont("\n");
pr_info(" world\n");
pr_info("5 hello");
pr_info(" world\n");
return -EAGAIN;
}
module_init(pr_cont_tests);
MODULE_LICENSE("GPL");
[root@localhost ~]# dmesg | grep 'pr_cont() tests' -A 10
[ 0.801262] pr_cont() tests:
[ 0.801642] 1 hello
[ 0.801926] world
[ 0.802212] 2 hello
[ 0.802529] world
[ 0.802805] 3 hello world
[ 0.803178] 4 hello
[ 0.803466] world
[ 0.803742] 5 hello
[ 0.803742] world
[ 0.806767] pcieport 0000:00:02.0: PME: Signaling with IRQ 24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment