Messages in this thread | | | Date | Wed, 7 Nov 2018 09:16:44 -0800 | From | Matthew Wilcox <> | Subject | Re: [PATCH v2] Document /proc/pid PID reuse behavior |
| |
On Tue, Nov 06, 2018 at 08:01:13AM +0200, Mike Rapoport wrote: > > diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt > > index 12a5e6e693b6..0b14460f721d 100644 > > --- a/Documentation/filesystems/proc.txt > > +++ b/Documentation/filesystems/proc.txt > > @@ -125,6 +125,13 @@ process running on the system, which is named after the process ID (PID). > > The link self points to the process reading the file system. Each process > > subdirectory has the entries listed in Table 1-1. > > > > +Note that an open a file descriptor to /proc/<pid> or to any of its
"open file descriptor" (the "a" is unnecessary)
> > +contained files or subdirectories does not prevent <pid> being reused > > +for some other process in the event that <pid> exits. Operations on > > +open /proc/<pid> file descriptors corresponding to dead processes > > +never act on any new process that the kernel may, through chance, have > > +also assigned the process ID <pid>. Instead, operations on these FDs > > +usually fail with ESRCH.
The paragraph is a bit wordy. More pithy:
An open file descriptor for /proc/<pid> (or any of the files or subdirectories in it) does not prevent <pid> from being reused after the process exits. Operations on a file descriptor referring to a dead process usually return ESRCH. They do not act on any new process which has been assigned the same <pid>.
| |