CONTRIBUTING.d/patches: Please provide a git-range-diff(1)
[man-pages.git] / man5 / proc_pid_environ.5
blob0ff8d48294b3bb7f791aba0689e33d74c911c027
1 .\" Copyright (C) 1994, 1995, Daniel Quinlan <quinlan@yggdrasil.com>
2 .\" Copyright (C) 2002-2008, 2017, Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" Copyright (C) 2023, Alejandro Colomar <alx@kernel.org>
4 .\"
5 .\" SPDX-License-Identifier: GPL-3.0-or-later
6 .\"
7 .TH proc_pid_environ 5 (date) "Linux man-pages (unreleased)"
8 .SH NAME
9 /proc/pid/environ \- initial environment
10 .SH DESCRIPTION
11 .TP
12 .IR /proc/ pid /environ
13 This file contains the initial environment that was set
14 when the currently executing program was started via
15 .BR execve (2).
16 The entries are separated by null bytes (\[aq]\e0\[aq]),
17 and there may be a null byte at the end.
18 Thus, to print out the environment of process 1, you would do:
19 .IP
20 .in +4n
21 .EX
22 .RB "$" " cat /proc/1/environ | tr \[aq]\e000\[aq] \[aq]\en\[aq]"
23 .EE
24 .in
25 .IP
26 If, after an
27 .BR execve (2),
28 the process modifies its environment
29 (e.g., by calling functions such as
30 .BR putenv (3)
31 or modifying the
32 .BR environ (7)
33 variable directly),
34 this file will
35 .I not
36 reflect those changes.
37 .IP
38 Furthermore, a process may change the memory location that this file refers via
39 .BR prctl (2)
40 operations such as
41 .BR PR_SET_MM_ENV_START .
42 .IP
43 Permission to access this file is governed by a ptrace access mode
44 .B PTRACE_MODE_READ_FSCREDS
45 check; see
46 .BR ptrace (2).
47 .SH SEE ALSO
48 .BR proc (5)