我想编写一个由 Linux 中的用户空间函数调用的内核空间函数,如下所示:
// kernel space function.
void hello_kernel()
{
printk(KERN_INFO "Hello kernel space.");
printk(KERN_INFO "I can do any thing!");
}
// user space function
void hello_kernel();
int main()
{
printf("Invoking a kernel space function.");
hello_kernel();
return 0;
}
我不知道这个示例代码是否可行。
如何编写由用户空间函数调用的内核空间函数?