Lines Matching refs:pidfd

104 #include <uapi/linux/pidfd.h>
1993 * __pidfd_prepare - allocate a new pidfd_file and reserve a pidfd
1994 * @pid: the struct pid for which to create a pidfd
1995 * @flags: flags of the new @pidfd
1996 * @ret: Where to return the file for the pidfd.
1998 * Allocate a new file that stashes @pid and reserve a new pidfd number in the
1999 * caller's file descriptor table. The pidfd is reserved but not installed yet.
2002 * created via CLONE_PIDFD where @pid has no task attached when the pidfd and
2003 * pidfd file are prepared.
2006 * call fd_install() passing the returned pidfd and pidfd file as arguments in
2007 * order to install the pidfd into its file descriptor table or they must use
2008 * put_unused_fd() and fput() on the returned pidfd and pidfd file
2011 * This function is useful when a pidfd must already be reserved but there
2013 * that no pidfd is leaked into its file descriptor table.
2015 * Return: On success, a reserved pidfd is returned from the function and a new
2016 * pidfd file is returned in the last argument to the function. On
2022 int pidfd;
2025 pidfd = get_unused_fd_flags(O_CLOEXEC);
2026 if (pidfd < 0)
2027 return pidfd;
2031 put_unused_fd(pidfd);
2040 return pidfd;
2044 * pidfd_prepare - allocate a new pidfd_file and reserve a pidfd
2045 * @pid: the struct pid for which to create a pidfd
2046 * @flags: flags of the new @pidfd
2047 * @ret: Where to return the pidfd.
2049 * Allocate a new file that stashes @pid and reserve a new pidfd number in the
2050 * caller's file descriptor table. The pidfd is reserved but not installed yet.
2056 * call fd_install() passing the returned pidfd and pidfd file as arguments in
2057 * order to install the pidfd into its file descriptor table or they must use
2058 * put_unused_fd() and fput() on the returned pidfd and pidfd file
2061 * This function is useful when a pidfd must already be reserved but there
2063 * that no pidfd is leaked into its file descriptor table.
2065 * Return: On success, a reserved pidfd is returned from the function and a new
2066 * pidfd file is returned in the last argument to the function. On
2140 int pidfd = -1, retval;
2416 * descriptor table (so that the pidfd doesn't leak into the child
2426 pidfd = retval;
2428 retval = put_user(pidfd, args->pidfd);
2610 fd_install(pidfd, pidfile);
2633 put_unused_fd(pidfd);
2767 * to return the pidfd. Hence, CLONE_PIDFD and CLONE_PARENT_SETTID are
2776 (args->pidfd == args->parent_tid))
2932 .pidfd = parent_tidptr,
2994 .pidfd = u64_to_user_ptr(args.pidfd),