summaryrefslogtreecommitdiff
path: root/include/linux/pid.h
diff options
context:
space:
mode:
authorChristian Brauner <christian.brauner@ubuntu.com>2021-10-11 16:32:44 +0300
committerChristian Brauner <christian.brauner@ubuntu.com>2021-10-14 14:29:18 +0300
commite9bdcdbf6936dd1fbf419e00222dc9038b7812c2 (patch)
tree1eabd32a68976f36fb256ad3c4b9723412adcea8 /include/linux/pid.h
parent64570fbc14f8d7cb3fe3995f20e26bc25ce4b2cc (diff)
downloadlinux-e9bdcdbf6936dd1fbf419e00222dc9038b7812c2.tar.xz
pid: add pidfd_get_task() helper
The number of system calls making use of pidfds is constantly increasing. Some of those new system calls duplicate the code to turn a pidfd into task_struct it refers to. Give them a simple helper for this. Link: https://lore.kernel.org/r/20211004125050.1153693-2-christian.brauner@ubuntu.com Link: https://lore.kernel.org/r/20211011133245.1703103-2-brauner@kernel.org Cc: Vlastimil Babka <vbabka@suse.cz> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Matthew Bobrowski <repnop@google.com> Cc: Alexander Duyck <alexander.h.duyck@linux.intel.com> Cc: David Hildenbrand <david@redhat.com> Cc: Jan Kara <jack@suse.cz> Cc: Minchan Kim <minchan@kernel.org> Reviewed-by: Matthew Bobrowski <repnop@google.com> Acked-by: David Hildenbrand <david@redhat.com> Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Diffstat (limited to 'include/linux/pid.h')
-rw-r--r--include/linux/pid.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/pid.h b/include/linux/pid.h
index af308e15f174..343abf22092e 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -78,6 +78,7 @@ struct file;
extern struct pid *pidfd_pid(const struct file *file);
struct pid *pidfd_get_pid(unsigned int fd, unsigned int *flags);
+struct task_struct *pidfd_get_task(int pidfd, unsigned int *flags);
int pidfd_create(struct pid *pid, unsigned int flags);
static inline struct pid *get_pid(struct pid *pid)