I am tinkering with device driver programming under Ubuntu 14.04.1 LTS and came across a strange behavior; hope you can shed some light on.
sudo insmod hello.ko whom="$"
yields the expected output:
Hello $ (0) !!!
but sudo insmod hello.ko whom="$$"
yields:
Hello 3275 (0) !!!
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/sched.h>
MODULE_LICENSE("Dual BSD/GPL");
static char *whom = "world";
static int howMany = 1;
static int __init hello_init(void){
int i;
for(i = 0; i < howMany; i++){
printk(KERN_ALERT "Hello %s (%d) !!!\n", whom, i);
}
return 0;
}
static void __exit hello_exit(void){
printk(KERN_ALERT "Bye bye %s !!!\n", whom);
}
module_init(hello_init);
module_exit(hello_exit);
module_param(howMany, int, S_IRUGO);
module_param(whom, charp, S_IRUGO);
sudo insmod hello.ko whom="\$"
does the job?