proc.5: Clarify that /proc/PID/environ is set at time of execve(2)

Reported-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2017-02-20 08:30:48 +01:00
parent 387e243882
commit 09651080d1
1 changed files with 9 additions and 3 deletions

View File

@ -477,7 +477,9 @@ check; see
.BR ptrace (2).
.TP
.I /proc/[pid]/environ
This file contains the initial environment for the process.
This file contains the initial environment that was set
when the currently executing program was started via
.BR execve (2).
The entries are separated by null bytes (\(aq\\0\(aq),
and there may be a null byte at the end.
Thus, to print out the environment of process 1, you would do:
@ -488,13 +490,17 @@ Thus, to print out the environment of process 1, you would do:
.fi
.in
Once a process starts modifying its environment
If, after an
.BR execve (2),
the process modifies its environment
(e.g. by calling functions such as
.BR putenv (3)
or modifying the
.BR environ (7)
variable directly),
this file will not be kept up to date.
this file will
.I not
reflect those changes.
Further, a process may change the memory this points to by calling
.BR prctl (2)