A mirror of Man pages
Go to file
Michael Kerrisk 30d0d39a4f pidfd_open.2: Opening /proc/PID doesn't yield a pollable file descriptor
Thus, pidfd_open() is the preferred way of obtaining a PID
file descriptor.

Notes from a conversation with Christian Brauner:

[[
> A further question... We now have three ways of getting a
> process file descriptor [*]:
>
> open() of /proc/PID
> pidfd_open()
> clone()/clone3() with CLONE_PIDFD
>
> I thought the FD was supposed to be equivalent in all three cases.
> However, if I try (on kernel 5.3) poll() an FD returned by opening
> /proc/PID, poll() tells me POLLNVAL for the FD. Is that difference
> intentional? (I am guessing it is not.)

It's intentional.
The short answer is that /proc/<pid> is a convenience for sending
signals.
The longer answer is that this stems from a heavy debate about what a
process file descriptor was supposed to be and some people pushing for
at least being able to use /proc/<pid> dirfds while ignoring security
problems as soon as you're talking about returning those fds from
clone(); not to mention the additional problems discovered when trying
to implementing this.
A "real" pidfd is one from CLONE_PIDFD or pidfd_open() and all features
such as exit notification, read, and other future extensions will only
be implemented on top of them.
As much as we'd have liked to get rid of two different file descriptor
types it doesn't hurt us much and is not that much different from what
we will e.g. see with fsinfo() in the new mount api which needs to work
on regular fds gotten via open()/openat() and mountfds gotten from
fsopen() and fspick(). The mountfds will also allow for advanced
operations that the other ones will not. There's even an argument to be
made that fds you will get from open()/openat() and openat2() are
different types since they have very different behavior; openat2()
returning fds that are non arbitrarily upgradable etc.
]]

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
man1 localedef.1: describe recently added options 2019-08-26 23:26:15 +02:00
man2 pidfd_open.2: Opening /proc/PID doesn't yield a pollable file descriptor 2019-10-10 12:24:28 +02:00
man3 pthreads.7: Minor tweaks to Carlos O'Donell's patch 2019-10-05 14:54:24 +03:00
man4 veth.4, persistent-keyring.7, process-keyring.7, session-keyring.7, thread-keyring.7, user-keyring.7, user-session-keyring.7: srcfix 2019-09-27 14:18:46 +02:00
man5 resolv.conf.5: srcfix 2019-09-13 16:01:58 +02:00
man6 intro.6: wfix 2017-08-25 21:41:03 +02:00
man7 signal.7: SEE ALSO: add pidfd_send_signal(2) 2019-10-10 12:24:28 +02:00
man8 ld.so.8: tfix 2019-08-26 23:14:49 +02:00
scripts scripts: mark them executable 2018-05-31 21:34:32 +02:00
CONTRIBUTING CONTRIBUTING: New file with some starting tips on how to contribute 2019-09-13 15:59:08 +02:00
Changes Start of man-pages-5.03: updating Changes and Changes.old 2019-08-02 10:31:40 +02:00
Changes.old Changes.old: Fixes to 5.02 log 2019-08-02 11:26:00 +02:00
Makefile Makefile: Remove a redundant comment 2017-11-20 10:38:10 +01:00
README README: tfix 2017-05-13 20:14:15 +02:00
man-pages-5.03.Announce Start of man-pages-5.03: updating .Announce and .lsm files 2019-08-02 10:31:40 +02:00
man-pages-5.03.lsm Start of man-pages-5.03: updating .Announce and .lsm files 2019-08-02 10:31:40 +02:00

README

This package contains Linux man pages for sections 1 through 8.  Some
more information is given in the 'man-pages-x.y.Announce' file.

Installing and uninstalling
===========================
"make install" will copy these man pages to /usr/share/man/man[1-8].

To install to a path different from /usr, use
"make install prefix=/install/path".

"make remove" or "make uninstall" will remove any man page in this
distribution from its destination.  Use with caution, and remember to
use "prefix" if desired, as with the "install" target.

"make" or "make all" will perform "make uninstall" followed by "make
install".

Man page overlap and duplication
================================
Note that sometimes these pages are duplicates of pages also distributed
in other packages.  This has been reported about:

man page                also found in
-------------------------------------
resolver.3              bind-utils, bind9utils
resolv.conf.5           "
passwd.5                shadow, passwd
mailaddr.7              ?

Copyrights
==========
See the 'man-pages-x.y.Announce' file.

Homepage
========
For much more about the Linux man-pages project, see
http://www.kernel.org/doc/man-pages/index.html.