Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6334

Why my kernel log is not showing the latest output?

$
0
0

I'm coding a simple kernel module, in Ubuntu 17.04, that takes a string and prints it in the kernel log.

#include<linux/module.h>#include<linux/init.h>#include<linux/moduleparam.h>char* mystring = "hello world";module_param(mystring ,charp ,S_IRUSR | S_IWUSR);void display(void){printk(KERN_ALERT "%s" ,mystring);}static int hello(void){//printk(KERN_ALERT "hello module");display();return 0;} static void bye(void){printk(KERN_ALERT "bye");}module_init(hello);module_exit(bye);

I run command make and then when I run insmod test.ko mystring="blahblahblah", the module will be inserted correctly but when I run dmesg it doesn't show the blahblahblah.

After I run rmmod test.ko and dmseg the expression blahblahblah will appear in the terminal. When I run insmod test.ko mystring="blahblahblah" again and then dmesg the blahblahblah will be printed.

what is the problem exactly? Is it my problem or the system?


Viewing all articles
Browse latest Browse all 6334

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>