Reputation: 13
I have a simple module, written as follows:
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
MODULE_LICENSE("GPL");
static int __init hellomod_init(void)
{
printk(KERN_DEBUG, "Hello, world!\n");
return 0;
}
static void __exit hellomod_exit(void)
{
printk(KERN_DEBUG, "Goodbye, world!");
}
module_init(hellomod_init);
module_exit(hellomod_exit);
and
$ cat /proc/sys/kernel/printk
7 7 7 7
so that any level messages should output.
The module loads and this can be verified with lsmod
, however no output is produced when loading or unloading the module and checking dmesg
.
I have tried replacing KERN_DEBUG
with lower levels and still no output, so I don't think the log level is the issue.
How else can I verify the hellomod_init()
function is called? If it is not being called, what is my error?
I am running and compiling against kernel version 4.6.1-2 on Arch Linux.
Upvotes: 1
Views: 954
Reputation: 8141
There shouldn't be a comma after KERN_DEBUG
. So it should look something like this:
static int __init hellomod_init(void)
{
printk(KERN_DEBUG "Hello, world!\n");
return 0;
}
Upvotes: 3