I have a doubt.
I opened the kernel and I changed the directory linux-3.1.1/fs/open.c
I changed the follow code in the 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:`` and ``
So I compiled and rebooted my linux(Ubuntu).
During the rebooting appeared a lot of **"Testing"** on the screen.
So up to now 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 good.
But I don´t understand why the **"Testing"** didn't appeared on the shell.
I mean , if when I reboot the pc appeared a lot of the word "Testing" , why this word doens´t appear when I execute the program above.
Just to add I include this libraries in this code above:
`unistd.h` , `fcntl.h` , `stdio.h` , `stdlib.h`
Thank you guys.
以上就是Linux-kernel: printk from "open" syscall don't work的详细内容,更多请关注web前端其它相关文章!