pidfd_open.2: Note the waitid() use case for PID file descriptors

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2019-10-12 22:40:09 +02:00
parent d069725512
commit 9e1b1cd286
1 changed files with 7 additions and 1 deletions

View File

@ -169,6 +169,10 @@ nothing can be read from the file descriptor
.RB ( read (2) .RB ( read (2)
on the file descriptor fails with the error on the file descriptor fails with the error
.BR EINVAL ). .BR EINVAL ).
.IP *
If the PID file descriptor refers to a child of the calling process,
then it can be waited on using
.BR waitid (2).
.PP .PP
The The
.BR pidfd_open () .BR pidfd_open ()
@ -182,7 +186,8 @@ However, the latter technique is possible only if the
file system is mounted; file system is mounted;
furthermore, the file descriptor obtained in this way is furthermore, the file descriptor obtained in this way is
.I not .I not
pollable. pollable and can't be waited on with
.BR waitid (2).
.SH EXAMPLE .SH EXAMPLE
The program below opens a PID file descriptor for the The program below opens a PID file descriptor for the
process whose PID is specified as its command-line argument. process whose PID is specified as its command-line argument.
@ -251,4 +256,5 @@ main(int argc, char *argv[])
.BR pidfd_send_signal (2), .BR pidfd_send_signal (2),
.BR poll (2), .BR poll (2),
.BR select (2), .BR select (2),
.BR waitid (2),
.BR epoll (7) .BR epoll (7)