Skip to content

Commit

Permalink
kernel/pid.c: remove static qualifier from pidfd_create()
Browse files Browse the repository at this point in the history
With the idea of returning pidfds from the fanotify API, we need to
expose a mechanism for creating pidfds. We drop the static qualifier
from pidfd_create() and add its declaration to linux/pid.h so that the
pidfd_create() helper can be called from other kernel subsystems
i.e. fanotify.

Link: https://lore.kernel.org/r/0c68653ec32f1b7143301f0231f7ed14062fd82b.1628398044.git.repnop@google.com
Signed-off-by: Matthew Bobrowski <[email protected]>
Acked-by: Christian Brauner <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
  • Loading branch information
Matthew Bobrowski authored and jankara committed Aug 10, 2021
1 parent 902e7f3 commit c576e0f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/linux/pid.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
int pidfd_create(struct pid *pid, unsigned int flags);

static inline struct pid *get_pid(struct pid *pid)
{
Expand Down
4 changes: 3 additions & 1 deletion kernel/pid.c
Original file line number Diff line number Diff line change
Expand Up @@ -550,10 +550,12 @@ struct pid *pidfd_get_pid(unsigned int fd, unsigned int *flags)
* Note, that this function can only be called after the fd table has
* been unshared to avoid leaking the pidfd to the new process.
*
* This symbol should not be explicitly exported to loadable modules.
*
* Return: On success, a cloexec pidfd is returned.
* On error, a negative errno number will be returned.
*/
static int pidfd_create(struct pid *pid, unsigned int flags)
int pidfd_create(struct pid *pid, unsigned int flags)
{
int fd;

Expand Down

0 comments on commit c576e0f

Please sign in to comment.