fd.c (f36c2943274199cb8aef32ac96531ffb7c4b43d0) | fd.c (64eb661fda0269276b4c46965832938e3f268268) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2#include <linux/sched/signal.h> 3#include <linux/errno.h> 4#include <linux/dcache.h> 5#include <linux/path.h> 6#include <linux/fdtable.h> 7#include <linux/namei.h> 8#include <linux/pid.h> --- 69 unchanged lines hidden (view full) --- 78 .open = seq_fdinfo_open, 79 .read = seq_read, 80 .llseek = seq_lseek, 81 .release = single_release, 82}; 83 84static bool tid_fd_mode(struct task_struct *task, unsigned fd, fmode_t *mode) 85{ | 1// SPDX-License-Identifier: GPL-2.0 2#include <linux/sched/signal.h> 3#include <linux/errno.h> 4#include <linux/dcache.h> 5#include <linux/path.h> 6#include <linux/fdtable.h> 7#include <linux/namei.h> 8#include <linux/pid.h> --- 69 unchanged lines hidden (view full) --- 78 .open = seq_fdinfo_open, 79 .read = seq_read, 80 .llseek = seq_lseek, 81 .release = single_release, 82}; 83 84static bool tid_fd_mode(struct task_struct *task, unsigned fd, fmode_t *mode) 85{ |
86 struct files_struct *files = get_files_struct(task); | |
87 struct file *file; 88 | 86 struct file *file; 87 |
89 if (!files) 90 return false; 91 | |
92 rcu_read_lock(); | 88 rcu_read_lock(); |
93 file = files_lookup_fd_rcu(files, fd); | 89 file = task_lookup_fd_rcu(task, fd); |
94 if (file) 95 *mode = file->f_mode; 96 rcu_read_unlock(); | 90 if (file) 91 *mode = file->f_mode; 92 rcu_read_unlock(); |
97 put_files_struct(files); | |
98 return !!file; 99} 100 101static void tid_fd_update_inode(struct task_struct *task, struct inode *inode, 102 fmode_t f_mode) 103{ 104 task_dump_owner(task, 0, &inode->i_uid, &inode->i_gid); 105 --- 251 unchanged lines hidden --- | 93 return !!file; 94} 95 96static void tid_fd_update_inode(struct task_struct *task, struct inode *inode, 97 fmode_t f_mode) 98{ 99 task_dump_owner(task, 0, &inode->i_uid, &inode->i_gid); 100 --- 251 unchanged lines hidden --- |