From c969eb830175f42b6cc0c8e80f6fce452fd75788 Mon Sep 17 00:00:00 2001 From: Daniel Colascione Date: Mon, 5 Nov 2018 13:22:05 +0000 Subject: [PATCH] Document /proc/pid PID reuse behavior State explicitly that holding a /proc/pid file descriptor open does not reserve the PID. Also note that in the event of PID reuse, these open file descriptors refer to the old, now-dead process, and not the new one that happens to be named the same numeric PID. Signed-off-by: Daniel Colascione Acked-by: Michal Hocko Reviewed-by: Mike Rapoport Signed-off-by: Jonathan Corbet --- Documentation/filesystems/proc.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt index a078efad9957..af88fa238786 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/ or to any of its +contained files or subdirectories does not prevent being reused +for some other process in the event that exits. Operations on +open /proc/ file descriptors corresponding to dead processes +never act on any new process that the kernel may, through chance, have +also assigned the process ID . Instead, operations on these FDs +usually fail with ESRCH. Table 1-1: Process specific entries in /proc ..............................................................................