简体   繁体   中英

linux kernel module permissions

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 value 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;
    //... 
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM