Re: multiple printk problem

From: Randy.Dunlap
Date: Fri May 28 2004 - 21:43:49 EST



| Hi, I'm quite new to kernel module programming,
| I was wondering why multiple consecutive calls to printk will not be
| correctly logged by the system logger (linux-2.4.25 with metalog without
| buffering in my case).
|
| Consider for example the following example, only the first message can
| be found in logs:
|
| #include <linux/version.h>
| #include <linux/init.h>
| #include <linux/module.h>
| #include <linux/kernel.h>
|
|
| MODULE_AUTHOR ("Vito Impagliazzo <vimpagliazzo@xxxxxxxxx>");
| MODULE_DESCRIPTION ("Hello World");
| MODULE_LICENSE("Dual BSD/GPL");
|
| static int hello_init(void)
| {
| printf(KERN_ALERT "1\n");
| printf(KERN_ALERT "2\n");
| printf(KERN_ALERT "3\n");
| return 0;
| }
|
| static void hello_exit(void)
| {
| printk(KERN_ALERT "Goodbye, cruel world\n");
| }
|
| module_init(hello_init);
| module_exit(hello_exit);

Hi,

Your module works fine if you change "printf" to "printk".

If you still fail to see all 3 messages, it's a metalog
problem and not a kernel problem.
You should be able to contact them at
http://sourceforge.net/projects/metalog/

--
~Randy
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/