diff options
| author | Christian Brauner <brauner@kernel.org> | 2023-03-27 20:22:51 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-06-04 14:32:36 +0200 |
| commit | 0a841d0a481e828c3e1211743c93788927a23b28 (patch) | |
| tree | 71c7e3dec904a2d1a9ada3b010cbba8df27aba4c /include | |
| parent | 53df781e0bd6db925b30f5b6a10798eef14896eb (diff) | |
| download | linux-0a841d0a481e828c3e1211743c93788927a23b28.tar.gz linux-0a841d0a481e828c3e1211743c93788927a23b28.tar.bz2 linux-0a841d0a481e828c3e1211743c93788927a23b28.zip | |
pid: add pidfd_prepare()
commit 6ae930d9dbf2d093157be33428538c91966d8a9f upstream.
Add a new helper that allows to reserve a pidfd and allocates a new
pidfd file that stashes the provided struct pid. This will allow us to
remove places that either open code this function or that call
pidfd_create() but then have to call close_fd() because there are still
failure points after pidfd_create() has been called.
Reviewed-by: Jan Kara <jack@suse.cz>
Message-Id: <20230327-pidfd-file-api-v1-1-5c0e9a3158e4@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/pid.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/pid.h b/include/linux/pid.h index 034e3cd60dc0..5216973610fd 100644 --- a/include/linux/pid.h +++ b/include/linux/pid.h @@ -75,6 +75,7 @@ extern const struct file_operations pidfd_fops; struct file; extern struct pid *pidfd_pid(const struct file *file); +int pidfd_prepare(struct pid *pid, unsigned int flags, struct file **ret); static inline struct pid *get_pid(struct pid *pid) { |
