How to get the current user's id when in write() function in kernel bin.c
I want to modify the write() function located in bin.c file in linux kernel and want to access the current user's id at that place. write() function code as follows in bin.c:
static ssize_t write(struct file *file, const char __user *userbuf,
size_t bytes, loff_t *off)
{ struct bin_buffer *bb = file->private_data;
struct dentry *dentry = file->f_path.dentry;
int size = dentry->d_inode->i_size;
int uid=dentry->d_inode->i_uid;
loff_t offs = *off;
int count = min_t(size_t, bytes, PAGE_SIZE);
char *temp;
...
/*want to access current user's id here*/
}
But I don't know how to access the user's id.
Any help?Thanks a lot.
|