I have doubts.
I opened the kernel and I changed the linux-3.1.1 / fs / open.c directory
I changed the following code in open.c.
SYSCALL_DEFINE3(open, const char __user *, filename, int, flags, int, mode) { long ret; printk(KERN_EMERG "Testing\n"); ... }
I put this line only: printk(KERN_EMERG "Testing");
And I include the libraries: <linux/kernel.h> and <linux/printk.h>
So, I compiled and rebooted my Linux (Ubuntu). During the reboot, a lot of "Testing" appeared on the screen. So, still its ok.
But now I have a problem. I created this program in c.
int main() { size_t filedesc = open("testefile2.txt",O_CREAT | O_WRONLY,0640); printf("%d",filedesc); }
I compiled this program and executed and works well. But I do not understand why "Testing" did not appear in the shell. I mean, if during the reboot of the PC a lot of the word "Testing" appeared, why this word does not appear when I execute the program above. Just add, I have included these libraries in this code above:
unistd.h , fcntl.h , stdio.h , stdlib.h
Thanks guys.