summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGünther Noack <gnoack@google.com>2023-05-24 16:33:07 +0200
committerAlejandro Colomar <alx@kernel.org>2023-05-25 01:28:40 +0200
commit2aa85ce3b0a85fbf6909e873c78959c2fbcc25ac (patch)
tree0e05705e7c29d2bf985554d7ea0817e11d9f0691
parent470b97d59797b040e28103a0ba0f616d95f0ed93 (diff)
proc.5: Clarify the format of /proc/$PID/cmdline
It is possible to produce /proc/$PID/cmdline files which do not follow the NUL-seperated format, by using the tricks described in the paragraph below. Signed-off-by: Günther Noack <gnoack@google.com> [ fix semantic newlines ] Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r--man5/proc.515
1 files changed, 13 insertions, 2 deletions
diff --git a/man5/proc.5 b/man5/proc.5
index a9bb175e8..723154edb 100644
--- a/man5/proc.5
+++ b/man5/proc.5
@@ -497,10 +497,21 @@ unless the process is a zombie.
.\" In Linux 2.3.26, this also used to be true if the process was swapped out.
In the latter case, there is nothing in this file:
that is, a read on this file will return 0 characters.
-The command-line arguments appear in this file as a set of
-strings separated by null bytes (\[aq]\e0\[aq]),
+.IP
+For processes which are still running,
+the command-line arguments appear in this file
+in the same layout as they do in process memory:
+If the process is well-behaved,
+it is a set of strings separated by null bytes (\[aq]\e0\[aq]),
with a further null byte after the last string.
.IP
+This is the common case,
+but processes have the freedom to
+override the memory region and
+break assumptions about the contents or format of the
+.IR /proc/ pid /cmdline
+file.
+.IP
If, after an
.BR execve (2),
the process modifies its