diff options
| author | Christian Brauner <brauner@kernel.org> | 2023-03-27 21:22:51 +0300 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-06-04 15:37:08 +0300 |
| commit | e5d92fd33ffa728f25f7325ebd4adaf14061aa56 (patch) | |
| tree | 54bcca59613c5dcf6d35478a2e8fd5b9f6e0652e /include/linux | |
| parent | 3ab0b54767ed3bba4cc943f86c2fedb5959ddb44 (diff) | |
| download | linux-e5d92fd33ffa728f25f7325ebd4adaf14061aa56.tar.xz | |
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/linux')
| -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 af308e15f174..f47868537209 100644 --- a/include/linux/pid.h +++ b/include/linux/pid.h @@ -79,6 +79,7 @@ struct file; extern struct pid *pidfd_pid(const struct file *file); struct pid *pidfd_get_pid(unsigned int fd, unsigned int *flags); int pidfd_create(struct pid *pid, unsigned int flags); +int pidfd_prepare(struct pid *pid, unsigned int flags, struct file **ret); static inline struct pid *get_pid(struct pid *pid) { |
