Linux设备驱动程序学习

之前在Ubuntu里编译scull时有错误,还好有网友提供了解决办法,即删除config.h文件和增加#include 两个头文件:capability.h和sched.h

最近将Ubuntu升级到9.10版本后,重新生成了2.6.31版本的内核树,没想到编译scull模块时出现新的error
error: 'struct task_struct' has no member named 'uid'
error: 'struct task_struct' has no member named 'euid'

struct task_struct定义在include/linux/sched.h中,原来task_struct结构体定义有所改动,将uid和euid等挪到cred中,见include/linux/sched.h和include/linux/cred.h。

因此只需要将报error的代码做如下修改
current->uid 修改为 current->cred->uid
current->euid 修改为 current->cred->euid

相关推荐