Kernel Hacking Issue
I recently added a printk statement to my timer.c file in /usr/src/linux-source-2-6-27/ so that each time SYS_GETPID was called I would have this printed out to my console and to my /var/log/messages file. However, when I create a simple program which uses getpid() and run it I neither get anything printed to the console nor to the messages file. The code for SYS_GETPID I put in is as follows:
I recompiled my kernel and installed it again but am not sure why this isn't working.
asmlinkage long sys_getpid(void)
printk(KERN_CRIT, "SYS_GETPID CALLED...\n");
Also, I just loaded a custom hello world module into the kernel successfully using the insmod function but this was not recorded to my /var/log/messages file. Is there another location in Ubuntu where this file is loaded?
Why don't you do one of the following:
1. cause a compiler error in you code (e.g. add dashsdhkfasjdjkasd78eq3 to somewhere in the code), to ensure that you are ACTUALLY compiling the source you think you are compiling.
2. If that works, add somehting that crashes the kernel when you get to a certain point (e.g getpid) - just make sure you have a back-up kernel that you can load if this happens [this is of course true whether you are intentionally causing the kernel to crash or not - becuase no matter how good you are, sooner or later you will make a mistake that causes the kernel to crash on startup, and this is when you need another kernel available to boot from].