aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/base.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r--fs/proc/base.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index f5ebdd87afb2..ddef482f1334 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -3074,6 +3074,15 @@ static const struct file_operations proc_tgid_base_operations = {
3074 .llseek = generic_file_llseek, 3074 .llseek = generic_file_llseek,
3075}; 3075};
3076 3076
3077struct pid *tgid_pidfd_to_pid(const struct file *file)
3078{
3079 if (!d_is_dir(file->f_path.dentry) ||
3080 (file->f_op != &proc_tgid_base_operations))
3081 return ERR_PTR(-EBADF);
3082
3083 return proc_pid(file_inode(file));
3084}
3085
3077static struct dentry *proc_tgid_base_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) 3086static struct dentry *proc_tgid_base_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
3078{ 3087{
3079 return proc_pident_lookup(dir, dentry, 3088 return proc_pident_lookup(dir, dentry,