我已经写了模块读/写在/ proc文件和工作正常,但要使用权限与它时,我给下面显示的权限,它给了我错误(基本上我希望每个人都可以读取文件,但只有根可以写在里面)。struct task_struct成员?
int my_permission(struct inode *inode, int op)
{
if(op == 4||(op == 2 && current->euid = 0)) //euid is not a member of task_struct
return 0;
return -EACCES;
}
const struct inode_operations my_iops = {
.permission = my_permission,
};
但它给我的错误如下:
/home/karan/practice/procf/testproc1.c: In function ‘my_permission’:
/home/karan/practice/procf/testproc1.c:50:32: error: ‘struct task_struct’ has no member named ‘euid’
我认为在task_struct中指向用户ID其他成员。我对解决方案以及task_struct成员字段的描述感兴趣。
问候 卡兰
你看过http://kernel.org/doc/htmldocs/ – 2012-02-02 19:00:55
@Shiplu我想要一些关于task_struct的具体内容,没有别的.........虽然链接很好。 – karan421 2012-02-02 19:08:55
Google“linux lxr”,找到'struct task_struct'的定义,看看你有哪些字段。 – ugoren 2012-02-02 19:37:18