Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct file *fget(unsigned int fd)
- {
- struct file *file;
- struct files_struct *files = current->files;
- rcu_read_lock();
- file = fcheck_files(files, fd);
- if (file) {
- /* File object ref couldn't be taken */
- if (file->f_mode & FMODE_PATH ||
- !atomic_long_inc_not_zero(&file->f_count))
- file = NULL;
- }
- rcu_read_unlock();
- return file;
- }
- asmlinkage int custom_read(int fd, void *buf, size_t noct)
- {
- struct file *filp = fget(fd);
- unsigned char f_name[DNAME_INLINE_LEN];
- strcpy(f_name,filp->f_path.dentry->d_name.name);
- // if (!strcmp(f_name, "_ttt.c")){
- // printk("hook1: read fd=(%d: -> %s)\n",fd,f_name);
- // return -1;
- // }
- return original_read(fd, buf, noct);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement