开发者

linux kernel module permissions

开发者 https://www.devze.com 2023-01-01 01:29 出处:网络
I wrote a kernel module and a user that opens it with O_RDWR mode, in the module_permission\'s func i get int op parameter ,

I wrote a kernel module and a user that opens it with O_RDWR mode,

in the module_permission's func i get int op parameter ,

and would like to know if its val开发者_StackOverflowue is the same as O_RDWR or maybe the system call open changes it to another known value , and if so where can i find it..

thanks a lot..


You mean your module exports a device node that the user opens as a file with O_RDWR? In this case if you are using a newer kernel, the mode is in the struct file* parameter passed to your module's open call:

int my_open(struct inode* inode, struct file* filep) 
{
    unsigned mode = file->f_mode;
    //... 
}
0

精彩评论

暂无评论...
验证码 换一张
取 消