Skip to contentSkip to conversation

multiple printk problem

DISCUSSION Randy.Dunlap 1 participant 1 message May 29, 2004 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
| 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 <[email protected]>");
|     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