# Re: \[PATCH v9 2/4\] pid: Implement pidfd\_getfd syscall

- From: Arnd Bergmann \<hidden\>
- Date: 2020-01-13 14:58:32 
- List: linux-api
- Page: https://ratatoskr.run/linux-api/2020/01/170404
- Thread: https://ratatoskr.run/linux-api/2020/01/170086/t.md

```text
On Tue, Jan 7, 2020 at 6:59 PM Sargun Dhillon [ref] wrote:
> +/**
> + * sys_pidfd_getfd() - Get a file descriptor from another process
> + *
> + * @pidfd:     the pidfd file descriptor of the process
> + * @fd:                the file descriptor number to get
> + * @flags:     flags on how to get the fd (reserved)
> + *
> + * This syscall gets a copy of a file descriptor from another process
> + * based on the pidfd, and file descriptor number. It requires that
> + * the calling process has the ability to ptrace the process represented
> + * by the pidfd. The process which is having its file descriptor copied
> + * is otherwise unaffected.
> + *
> + * Return: On success, a cloexec file descriptor is returned.
> + *         On error, a negative errno number will be returned.
> + */
> +SYSCALL_DEFINE3(pidfd_getfd, int, pidfd, int, fd,
> +               unsigned int, flags)

This is the most sensible definition I can see. I can not tell
whether we should or want to have it, but if everyone thinks
this is a good idea, then this ABI makes sense.

Reviewed-by: Arnd Bergmann <redacted>
```
