问题:编译内核模块时出现
./arch/x86/include/asm/uaccess.h: In function ‘set_fs’:
./arch/x86/include/asm/uaccess.h:32:9: error: dereferencing pointer to incomplete type ‘struct task_struct’
current->thread.addr_limit = fs;
编译时无法识别task_struct,检查其头文件sched.h是有包括的,但是放在了uaccess.h下面了,所以在后者编译时找不到task_struct的定义。
将sched.h声明放到uaccess.h前面: