pidfd_getfd.2: Note the parallels and differences with SCM_RIGHTS messages

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2020-04-01 07:30:48 +02:00
parent 13aa2b3014
commit be04cb5051
1 changed files with 26 additions and 0 deletions

View File

@ -116,6 +116,32 @@ Currently, there is no glibc wrapper for this system call; call it using
.PP
For a description of PID file descriptors, see
.BR pidfd_open (2).
.PP
The effect of
.BR pidfd_getfd ()
is similar to the use of
.BR SCM_RIGHTS
messages described in
.BR unix (7),
but differs in the following respects:
.IP \(bu 2
In order to pass a file descriptor using an
.BR SCM_RIGHTS
message,
the two processes must first establish a UNIX domain socket connection.
.IP \(bu
The use of
.BR SCM_RIGHTS
requires cooperation on the part of the process whose
file descriptor is being copied.
By contrast, no such cooperation is necessary when using
.BR pidfd_getfd ().
.IP \(bu
The ability to use
.BR pidfd_getfd ()
is restricted by a
.BR PTRACE_MODE_ATTACH_REALCREDS
ptrace access mode check.
.SH SEE ALSO
.BR clone3 (2),
.BR dup (2),